diff --git a/test/specs/commonmark/commonmark-spec.js b/test/specs/commonmark/commonmark-spec.js deleted file mode 100644 index ec270bb831..0000000000 --- a/test/specs/commonmark/commonmark-spec.js +++ /dev/null @@ -1,454 +0,0 @@ -var marked = require('../../../lib/marked.js'); -var cmSpec = require('./commonmark.0.28.json'); -var HtmlDiffer = require('@markedjs/html-differ').HtmlDiffer, - htmlDiffer = new HtmlDiffer({ignoreSelfClosingSlash: true}); -var since = require('jasmine2-custom-message'); - -var Messenger = function() {}; - -Messenger.prototype.message = function(spec, expected, actual) { - return 'CommonMark (' + spec.section + '):\n' + spec.markdown + '\n------\n\nExpected:\n' + expected + '\n------\n\nMarked:\n' + actual; -}; - -Messenger.prototype.test = function(spec, section, ignore) { - if (spec.section === section) { - var shouldFail = ~ignore.indexOf(spec.example); - it('should ' + (shouldFail ? 'fail' : 'pass') + ' example ' + spec.example, function() { - var expected = spec.html; - var actual = marked(spec.markdown, { headerIds: false, xhtml: true }); - since(messenger.message(spec, expected, actual)).expect( - htmlDiffer.isEqual(expected, actual) - ).toEqual(!shouldFail); - }); - } -}; - -var messenger = new Messenger(); -/* -|Section |Count |Percent | -|:---------------------------------------|:---------:|-------:| -|Tabs | 10 of 11 | 91%| -|Precedence | 1 of 1 | 100%| -|Thematic breaks | 19 of 19 | 100%| -|ATX headings | 14 of 18 | 78%| -|Setext headings | 21 of 26 | 81%| -|Indented code blocks | 12 of 12 | 100%| -|Fenced code blocks | 21 of 28 | 75%| -|HTML blocks | 43 of 43 | 100%| -|Link reference definitions | 22 of 23 | 96%| -|Paragraphs | 8 of 8 | 100%| -|Blank lines | 1 of 1 | 100%| -|Block quotes | 21 of 25 | 84%| -|List items | 32 of 48 | 67%| -|Lists | 12 of 24 | 50%| -|Inlines | 1 of 1 | 100%| -|Backslash escapes | 10 of 13 | 77%| -|Entity and numeric character references | 9 of 12 | 75%| -|Code spans | 11 of 17 | 65%| -|Emphasis and strong emphasis | 79 of 128 | 61%| -|Links | 69 of 84 | 82%| -|Images | 15 of 22 | 68%| -|Autolinks | 15 of 19 | 79%| -|Raw HTML | 19 of 21 | 90%| -|Hard line breaks | 15 of 15 | 100%| -|Soft line breaks | 2 of 2 | 100%| -|Textual content | 3 of 3 | 100%| -*/ - -describe('CommonMark 0.28 Tabs', function() { - var section = 'Tabs'; - - // These examples probably should pass but don't for some reason. - // This is the easiest way to demonstrate limitations or defects - // within Marked. Toggle comments for next two lines to see which examples - // are known failures. Note: If all arrays are empty, it means Marked is - // 100% compliant with that section of the given specification. - // - // var shouldPassButFails = []; - var shouldPassButFails = [7]; - - // Identifies examples that the Marked core team has determined beyond - // the ability or desire to correct; thereby, implicitly requesting - // outside help and assistance. - var willNotBeAttemptedByCoreTeam = []; - - // Combine known failures and skips. - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - // Run test. - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Precedence', function() { - var section = 'Precedence'; - - // var shouldPassButFails = []; - var shouldPassButFails = []; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Thematic breaks', function() { - var section = 'Thematic breaks'; - - // var shouldPassButFails = []; - var shouldPassButFails = []; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 ATX headings', function() { - var section = 'ATX headings'; - - // var shouldPassButFails = []; - var shouldPassButFails = [40, 45, 46, 49]; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Setext headings', function() { - var section = 'Setext headings'; - - // var shouldPassButFails = []; - var shouldPassButFails = [51, 52, 56, 62, 64]; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Indented code blocks', function() { - var section = 'Indented code blocks'; - - // var shouldPassButFails = []; - var shouldPassButFails = []; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Fenced code blocks', function() { - var section = 'Fenced code blocks'; - - var shouldPassButFails = []; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 HTML blocks', function() { - var section = 'HTML blocks'; - - var shouldPassButFails = []; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Link reference definitions', function() { - var section = 'Link reference definitions'; - - // var shouldPassButFails = []; - var shouldPassButFails = [167]; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Paragraphs', function() { - var section = 'Paragraphs'; - - // var shouldPassButFails = []; - var shouldPassButFails = []; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Blank lines', function() { - var section = 'Blank lines'; - - // var shouldPassButFails = []; - var shouldPassButFails = []; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Block quotes', function() { - var section = 'Block quotes'; - - // var shouldPassButFails = []; - var shouldPassButFails = [198, 199, 200]; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 List items', function() { - var section = 'List items'; - - // var shouldPassButFails = []; - var shouldPassButFails = [237, 236, 227, 218, 243, 259, 241, 239, 247, 225, 220, 258, 260]; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Lists', function() { - var section = 'Lists'; - - // var shouldPassButFails = []; - var shouldPassButFails = [282, 270, 280, 278, 273, 274, 264, 265, 279, 267, 269]; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Inlines', function() { - var section = 'Inlines'; - - // var shouldPassButFails = []; - var shouldPassButFails = []; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Backslash escapes', function() { - var section = 'Backslash escapes'; - - // var shouldPassButFails = []; - var shouldPassButFails = [300, 301]; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Entity and numeric character references', function() { - var section = 'Entity and numeric character references'; - - // var shouldPassButFails = []; - var shouldPassButFails = [311, 309, 310]; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Code spans', function() { - var section = 'Code spans'; - - var shouldPassButFails = [322, 323]; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Emphasis and strong emphasis', function() { - var section = 'Emphasis and strong emphasis'; - - // var shouldPassButFails = []; - var shouldPassButFails = [334, 342, 348, 349, 352, 353, 360, 368, 369, 371, 372, 378, 380, 381, 382, 387, 388, 392, 393, 394, 395, 396, 402, 403, 409, 419, 420, 421, 422, 423, 424, 431, 432, 433, 434, 435, 436, 443, 444, 445, 448, 449, 453, 454, 455, 457, 458]; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Links', function() { - var section = 'Links'; - - // var shouldPassButFails = []; - var shouldPassButFails = [474, 478, 483, 489, 490, 491, 495, 496, 497, 499, 503, 504, 507, 508, 509]; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Images', function() { - var section = 'Images'; - - // var shouldPassButFails = []; - var shouldPassButFails = [544, 545, 546, 547, 548, 556, 560]; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Autolinks', function() { - var section = 'Autolinks'; - - // var shouldPassButFails = []; - var shouldPassButFails = [582, 573, 579, 583]; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Raw HTML', function() { - var section = 'Raw HTML'; - - // var shouldPassButFails = []; - var shouldPassButFails = [597, 598]; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Hard line breaks', function() { - var section = 'Hard line breaks'; - - // var shouldPassButFails = []; - var shouldPassButFails = []; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Soft line breaks', function() { - var section = 'Soft line breaks'; - - // var shouldPassButFails = []; - var shouldPassButFails = []; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('CommonMark 0.28 Textual content', function() { - var section = 'Textual content'; - - // var shouldPassButFails = []; - var shouldPassButFails = []; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - cmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); diff --git a/test/specs/commonmark/commonmark.0.28.json b/test/specs/commonmark/commonmark.0.28.json index ec9a9fe15b..5b5001cd79 100644 --- a/test/specs/commonmark/commonmark.0.28.json +++ b/test/specs/commonmark/commonmark.0.28.json @@ -53,7 +53,8 @@ "html": "
foo\n
\nfoo\n# bar
\n", "markdown": "foo\n # bar\n", "example": 40, - "start_line": 860 + "start_line": 860, + "shouldFail": true }, { "end_line": 877, @@ -357,7 +359,8 @@ "html": "Foo\n---
\n", "markdown": "Foo\n ---\n", "example": 56, - "start_line": 1092 + "start_line": 1092, + "shouldFail": true }, { "end_line": 1114, @@ -493,7 +501,8 @@ "html": "\n\n", "markdown": "> foo\nbar\n===\n", "example": 62, - "start_line": 1170 + "start_line": 1170, + "shouldFail": true }, { "end_line": 1191, @@ -509,7 +518,8 @@ "html": "foo\nbar\n===
\n
\n\n\n
\n- foo
\n
\n\n\nfoo\n
bar\n
\n",
"markdown": "> foo\n bar\n",
"example": 199,
- "start_line": 3396
+ "start_line": 3396,
+ "shouldFail": true
},
{
"end_line": 3419,
@@ -1597,7 +1610,8 @@
"html": "\n\n\n
foo
\n
\n",
"markdown": "> ```\nfoo\n```\n",
"example": 200,
- "start_line": 3409
+ "start_line": 3409,
+ "shouldFail": true
},
{
"end_line": 3433,
@@ -1741,7 +1755,8 @@
"html": "two
\n", "markdown": "- one\n\n two\n", "example": 218, - "start_line": 3749 + "start_line": 3749, + "shouldFail": true }, { "end_line": 3772, @@ -1757,7 +1772,8 @@ "html": " two\n
\n",
"markdown": " - one\n\n two\n",
"example": 220,
- "start_line": 3775
+ "start_line": 3775,
+ "shouldFail": true
},
{
"end_line": 3799,
@@ -1797,7 +1813,8 @@
"html": "foo
\nbar
\nFoo
\nbar\n\n\nbaz\n
\nindented code\n
\nparagraph
\nmore code\n
\n indented code\n
\nparagraph
\nmore code\n
\nbar
\n", "markdown": "- foo\n\n bar\n", "example": 239, - "start_line": 4108 + "start_line": 4108, + "shouldFail": true }, { "end_line": 4136, @@ -1925,7 +1946,8 @@ "html": "bar\n
\nbaz\n
\nfoo
\n", "markdown": "-\n\n foo\n", "example": 243, - "start_line": 4193 + "start_line": 4193, + "shouldFail": true }, { "end_line": 4217, @@ -1973,7 +1996,8 @@ "html": "The number of windows in my house is\n14. The number of doors is 6.
\n", "markdown": "The number of windows in my house is\n14. The number of doors is 6.\n", "example": 267, - "start_line": 4920 + "start_line": 4920, + "shouldFail": true }, { "end_line": 4938, @@ -2149,7 +2179,8 @@ "html": "foo
\nbar
\nbaz
\nbaz
\nbim
\na
\nb
\nc
\na
\nb
\nd
\nb\n\n\n
\nb
\nc
\n\n\nb
\n
c\n
\nfoo\n
\n",
"markdown": "``` foo\\+bar\nfoo\n```\n",
"example": 301,
- "start_line": 5511
+ "start_line": 5511,
+ "shouldFail": true
},
{
"end_line": 5546,
@@ -2469,7 +2509,8 @@
"html": "\n",
"markdown": "[foo](/föö \"föö\")\n",
"example": 309,
- "start_line": 5620
+ "start_line": 5620,
+ "shouldFail": true
},
{
"end_line": 5633,
@@ -2477,7 +2518,8 @@
"html": "\n",
"markdown": "[foo]\n\n[foo]: /föö \"föö\"\n",
"example": 310,
- "start_line": 5627
+ "start_line": 5627,
+ "shouldFail": true
},
{
"end_line": 5643,
@@ -2485,7 +2527,8 @@
"html": "foo\n
\n",
"markdown": "``` föö\nfoo\n```\n",
"example": 311,
- "start_line": 5636
+ "start_line": 5636,
+ "shouldFail": true
},
{
"end_line": 5653,
@@ -2573,7 +2616,8 @@
"html": "*foo*
[not a link](/foo
)
* a *
\n", "markdown": "* a *\n", "example": 334, - "start_line": 6091 + "start_line": 6091, + "shouldFail": true }, { "end_line": 6104, @@ -2733,7 +2779,8 @@ "html": "пристаням_стремятся_
\n", "markdown": "пристаням_стремятся_\n", "example": 342, - "start_line": 6159 + "start_line": 6159, + "shouldFail": true }, { "end_line": 6173, @@ -2781,7 +2828,8 @@ "html": "*(*foo)
\n", "markdown": "*(*foo)\n", "example": 348, - "start_line": 6224 + "start_line": 6224, + "shouldFail": true }, { "end_line": 6238, @@ -2789,7 +2837,8 @@ "html": "(foo)
\n", "markdown": "*(*foo*)*\n", "example": 349, - "start_line": 6234 + "start_line": 6234, + "shouldFail": true }, { "end_line": 6247, @@ -2813,7 +2862,8 @@ "html": "_(_foo)
\n", "markdown": "_(_foo)\n", "example": 352, - "start_line": 6266 + "start_line": 6266, + "shouldFail": true }, { "end_line": 6279, @@ -2821,7 +2871,8 @@ "html": "(foo)
\n", "markdown": "_(_foo_)_\n", "example": 353, - "start_line": 6275 + "start_line": 6275, + "shouldFail": true }, { "end_line": 6288, @@ -2877,7 +2928,8 @@ "html": "a**"foo"**
\n", "markdown": "a**\"foo\"**\n", "example": 360, - "start_line": 6339 + "start_line": 6339, + "shouldFail": true }, { "end_line": 6352, @@ -2941,7 +2993,8 @@ "html": "пристаням__стремятся__
\n", "markdown": "пристаням__стремятся__\n", "example": 368, - "start_line": 6410 + "start_line": 6410, + "shouldFail": true }, { "end_line": 6421, @@ -2949,7 +3002,8 @@ "html": "foo, bar, baz
\n", "markdown": "__foo, __bar__, baz__\n", "example": 369, - "start_line": 6417 + "start_line": 6417, + "shouldFail": true }, { "end_line": 6432, @@ -2965,7 +3019,8 @@ "html": "**foo bar **
\n", "markdown": "**foo bar **\n", "example": 371, - "start_line": 6441 + "start_line": 6441, + "shouldFail": true }, { "end_line": 6458, @@ -2973,7 +3028,8 @@ "html": "**(**foo)
\n", "markdown": "**(**foo)\n", "example": 372, - "start_line": 6454 + "start_line": 6454, + "shouldFail": true }, { "end_line": 6468, @@ -3021,7 +3077,8 @@ "html": "__(__foo)
\n", "markdown": "__(__foo)\n", "example": 378, - "start_line": 6511 + "start_line": 6511, + "shouldFail": true }, { "end_line": 6525, @@ -3037,7 +3094,8 @@ "html": "__foo__bar
\n", "markdown": "__foo__bar\n", "example": 380, - "start_line": 6530 + "start_line": 6530, + "shouldFail": true }, { "end_line": 6541, @@ -3045,7 +3103,8 @@ "html": "__пристаням__стремятся
\n", "markdown": "__пристаням__стремятся\n", "example": 381, - "start_line": 6537 + "start_line": 6537, + "shouldFail": true }, { "end_line": 6548, @@ -3053,7 +3112,8 @@ "html": "foo__bar__baz
\n", "markdown": "__foo__bar__baz__\n", "example": 382, - "start_line": 6544 + "start_line": 6544, + "shouldFail": true }, { "end_line": 6559, @@ -3093,7 +3153,8 @@ "html": "foo bar baz
\n", "markdown": "_foo _bar_ baz_\n", "example": 387, - "start_line": 6593 + "start_line": 6593, + "shouldFail": true }, { "end_line": 6604, @@ -3101,7 +3162,8 @@ "html": "foo bar
\n", "markdown": "__foo_ bar_\n", "example": 388, - "start_line": 6600 + "start_line": 6600, + "shouldFail": true }, { "end_line": 6611, @@ -3133,7 +3195,8 @@ "html": "foo bar
\n", "markdown": "***foo** bar*\n", "example": 392, - "start_line": 6645 + "start_line": 6645, + "shouldFail": true }, { "end_line": 6656, @@ -3141,7 +3204,8 @@ "html": "foo bar
\n", "markdown": "*foo **bar***\n", "example": 393, - "start_line": 6652 + "start_line": 6652, + "shouldFail": true }, { "end_line": 6663, @@ -3149,7 +3213,8 @@ "html": "foobar
\n", "markdown": "*foo**bar***\n", "example": 394, - "start_line": 6659 + "start_line": 6659, + "shouldFail": true }, { "end_line": 6672, @@ -3157,7 +3222,8 @@ "html": "foo bar baz bim bop
\n", "markdown": "*foo **bar *baz* bim** bop*\n", "example": 395, - "start_line": 6668 + "start_line": 6668, + "shouldFail": true }, { "end_line": 6679, @@ -3165,7 +3231,8 @@ "html": "foo bar
\n", "markdown": "*foo [*bar*](/url)*\n", "example": 396, - "start_line": 6675 + "start_line": 6675, + "shouldFail": true }, { "end_line": 6688, @@ -3213,7 +3280,8 @@ "html": "foo bar baz
\n", "markdown": "__foo __bar__ baz__\n", "example": 402, - "start_line": 6730 + "start_line": 6730, + "shouldFail": true }, { "end_line": 6741, @@ -3221,7 +3289,8 @@ "html": "foo bar
\n", "markdown": "____foo__ bar__\n", "example": 403, - "start_line": 6737 + "start_line": 6737, + "shouldFail": true }, { "end_line": 6748, @@ -3269,7 +3338,8 @@ "html": "foo bar baz\nbim bop
\n", "markdown": "**foo *bar **baz**\nbim* bop**\n", "example": 409, - "start_line": 6781 + "start_line": 6781, + "shouldFail": true }, { "end_line": 6794, @@ -3349,7 +3419,8 @@ "html": "*foo
\n", "markdown": "**foo*\n", "example": 419, - "start_line": 6862 + "start_line": 6862, + "shouldFail": true }, { "end_line": 6873, @@ -3357,7 +3428,8 @@ "html": "foo*
\n", "markdown": "*foo**\n", "example": 420, - "start_line": 6869 + "start_line": 6869, + "shouldFail": true }, { "end_line": 6880, @@ -3365,7 +3437,8 @@ "html": "*foo
\n", "markdown": "***foo**\n", "example": 421, - "start_line": 6876 + "start_line": 6876, + "shouldFail": true }, { "end_line": 6887, @@ -3373,7 +3446,8 @@ "html": "***foo
\n", "markdown": "****foo*\n", "example": 422, - "start_line": 6883 + "start_line": 6883, + "shouldFail": true }, { "end_line": 6894, @@ -3381,7 +3455,8 @@ "html": "foo*
\n", "markdown": "**foo***\n", "example": 423, - "start_line": 6890 + "start_line": 6890, + "shouldFail": true }, { "end_line": 6901, @@ -3389,7 +3464,8 @@ "html": "foo***
\n", "markdown": "*foo****\n", "example": 424, - "start_line": 6897 + "start_line": 6897, + "shouldFail": true }, { "end_line": 6911, @@ -3445,7 +3521,8 @@ "html": "_foo
\n", "markdown": "__foo_\n", "example": 431, - "start_line": 6949 + "start_line": 6949, + "shouldFail": true }, { "end_line": 6964, @@ -3453,7 +3530,8 @@ "html": "foo_
\n", "markdown": "_foo__\n", "example": 432, - "start_line": 6960 + "start_line": 6960, + "shouldFail": true }, { "end_line": 6971, @@ -3461,7 +3539,8 @@ "html": "_foo
\n", "markdown": "___foo__\n", "example": 433, - "start_line": 6967 + "start_line": 6967, + "shouldFail": true }, { "end_line": 6978, @@ -3469,7 +3548,8 @@ "html": "___foo
\n", "markdown": "____foo_\n", "example": 434, - "start_line": 6974 + "start_line": 6974, + "shouldFail": true }, { "end_line": 6985, @@ -3477,7 +3557,8 @@ "html": "foo_
\n", "markdown": "__foo___\n", "example": 435, - "start_line": 6981 + "start_line": 6981, + "shouldFail": true }, { "end_line": 6992, @@ -3485,7 +3566,8 @@ "html": "foo___
\n", "markdown": "_foo____\n", "example": 436, - "start_line": 6988 + "start_line": 6988, + "shouldFail": true }, { "end_line": 7002, @@ -3541,7 +3623,8 @@ "html": "foo
\n", "markdown": "******foo******\n", "example": 443, - "start_line": 7047 + "start_line": 7047, + "shouldFail": true }, { "end_line": 7060, @@ -3549,7 +3632,8 @@ "html": "foo
\n", "markdown": "***foo***\n", "example": 444, - "start_line": 7056 + "start_line": 7056, + "shouldFail": true }, { "end_line": 7067, @@ -3557,7 +3641,8 @@ "html": "foo
\n", "markdown": "_____foo_____\n", "example": 445, - "start_line": 7063 + "start_line": 7063, + "shouldFail": true }, { "end_line": 7076, @@ -3581,7 +3666,8 @@ "html": "**foo bar baz
\n", "markdown": "**foo **bar baz**\n", "example": 448, - "start_line": 7088 + "start_line": 7088, + "shouldFail": true }, { "end_line": 7099, @@ -3589,7 +3675,8 @@ "html": "*foo bar baz
\n", "markdown": "*foo *bar baz*\n", "example": 449, - "start_line": 7095 + "start_line": 7095, + "shouldFail": true }, { "end_line": 7108, @@ -3621,7 +3708,8 @@ "html": "\n", "markdown": "**\n", "example": 453, - "start_line": 7125 + "start_line": 7125, + "shouldFail": true }, { "end_line": 7136, @@ -3629,7 +3717,8 @@ "html": "\n", "markdown": "__\n", "example": 454, - "start_line": 7132 + "start_line": 7132, + "shouldFail": true }, { "end_line": 7143, @@ -3637,7 +3726,8 @@ "html": "a *
[foo bar](/uri)
\n", "markdown": "[foo [bar](/uri)](/uri)\n", "example": 489, - "start_line": 7538 + "start_line": 7538, + "shouldFail": true }, { "end_line": 7549, @@ -3917,7 +4013,8 @@ "html": "[foo [bar baz](/uri)](/uri)
\n", "markdown": "[foo *[bar [baz](/uri)](/uri)*](/uri)\n", "example": 490, - "start_line": 7545 + "start_line": 7545, + "shouldFail": true }, { "end_line": 7556, @@ -3925,7 +4022,8 @@ "html": "\n", "markdown": "![[[foo](uri1)](uri2)](uri3)\n", "example": 491, - "start_line": 7552 + "start_line": 7552, + "shouldFail": true }, { "end_line": 7566, @@ -3957,7 +4055,8 @@ "html": "[foo
[foo](/uri)
[foohttp://example.com/?search=](uri)
\n", "markdown": "[foo[foo
[foo][ref]
[foohttp://example.com/?search=][ref]
\n", "markdown": "[foo<http://foo.bar/baz bim>
\n", "markdown": "< http://foo.bar >
\n", "markdown": "< http://foo.bar >\n", "example": 579, - "start_line": 8559 + "start_line": 8559, + "shouldFail": true }, { "end_line": 8570, @@ -4653,7 +4769,8 @@ "html": "http://example.com
\n", "markdown": "http://example.com\n", "example": 582, - "start_line": 8580 + "start_line": 8580, + "shouldFail": true }, { "end_line": 8591, @@ -4661,7 +4778,8 @@ "html": "foo@bar.example.com
\n", "markdown": "foo@bar.example.com\n", "example": 583, - "start_line": 8587 + "start_line": 8587, + "shouldFail": true }, { "end_line": 8673, @@ -4773,7 +4891,8 @@ "html": "foo <!-- not a comment -- two hyphens -->
\n", "markdown": "foo \n", "example": 597, - "start_line": 8792 + "start_line": 8792, + "shouldFail": true }, { "end_line": 8808, @@ -4781,7 +4900,8 @@ "html": "foo <!--> foo -->
\nfoo <!-- foo--->
\n", "markdown": "foo foo -->\n\nfoo \n", "example": 598, - "start_line": 8801 + "start_line": 8801, + "shouldFail": true }, { "end_line": 8817, @@ -4991,4 +5111,4 @@ "example": 624, "start_line": 9070 } -] \ No newline at end of file +] diff --git a/test/specs/gfm/gfm-spec.js b/test/specs/gfm/gfm-spec.js deleted file mode 100644 index 83340db0fa..0000000000 --- a/test/specs/gfm/gfm-spec.js +++ /dev/null @@ -1,96 +0,0 @@ -var marked = require('../../../lib/marked.js'); -var gfmSpec = require('./gfm.0.28.json'); -var HtmlDiffer = require('@markedjs/html-differ').HtmlDiffer, - htmlDiffer = new HtmlDiffer({ignoreSelfClosingSlash: true}); -var since = require('jasmine2-custom-message'); - -var Messenger = function() {}; - -Messenger.prototype.message = function(spec, expected, actual) { - return 'CommonMark (' + spec.section + '):\n' + spec.markdown + '\n------\n\nExpected:\n' + expected + '\n------\n\nMarked:\n' + actual; -}; - -Messenger.prototype.test = function(spec, section, ignore) { - if (spec.section === section && ignore.indexOf(spec.example) < 0) { - var shouldFail = ~ignore.indexOf(spec.example); - it('should ' + (shouldFail ? 'fail' : 'pass') + ' example ' + spec.example, function() { - var expected = spec.html; - var actual = marked(spec.markdown, { headerIds: false, xhtml: false }); - since(messenger.message(spec, expected, actual)).expect( - htmlDiffer.isEqual(expected, actual) - ).toEqual(!shouldFail); - }); - } -}; - -var messenger = new Messenger(); - -describe('GFM 0.28 Tables', function() { - var section = 'Tables'; - - var shouldPassButFails = []; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - gfmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('GFM 0.28 Task list items', function() { - var section = 'Task list items'; - - var shouldPassButFails = []; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - gfmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('GFM 0.28 Strikethrough', function() { - var section = 'Strikethrough'; - - var shouldPassButFails = []; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - gfmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('GFM 0.28 Autolinks', function() { - var section = 'Autolinks'; - - var shouldPassButFails = [607]; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - gfmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); - -describe('GFM 0.28 Disallowed Raw HTML', function() { - var section = 'Disallowed Raw HTML'; - - var shouldPassButFails = [629]; - - var willNotBeAttemptedByCoreTeam = []; - - var ignore = shouldPassButFails.concat(willNotBeAttemptedByCoreTeam); - - gfmSpec.forEach(function(spec) { - messenger.test(spec, section, ignore); - }); -}); diff --git a/test/specs/gfm/gfm.0.28.json b/test/specs/gfm/gfm.0.28.json index d045f8af62..f9c28eb2ab 100644 --- a/test/specs/gfm/gfm.0.28.json +++ b/test/specs/gfm/gfm.0.28.json @@ -141,12 +141,14 @@ "section": "Autolinks", "html": "\n\na.b-c_d@a.b-
\na.b-c_d@a.b_
", "markdown": "a.b-c_d@a.b\n\na.b-c_d@a.b.\n\na.b-c_d@a.b-\n\na.b-c_d@a.b_", - "example": 607 + "example": 607, + "shouldFail": true }, { "section": "Disallowed Raw HTML", "html": "<title> <style>
\n\n <xmp> is disallowed. <XMP> is also disallowed.\n", "markdown": "