diff --git a/package.json b/package.json index 0afc5e7388..5ebeef7ef5 100644 --- a/package.json +++ b/package.json @@ -43,8 +43,8 @@ "test": "jasmine --config=jasmine.json", "test:unit": "npm test -- test/unit/**/*-spec.js", "test:specs": "npm test -- test/specs/**/*-spec.js", + "test:cm": "npm test -- test/specs/commonmark/**/*-spec.js", "test:gfm": "npm test -- test/specs/gfm/**/*-spec.js", - "test:integration": "npm test -- test/integration/**/*-spec.js", "test:old": "node test", "test:lint": "eslint bin/marked .", "bench": "node test --bench", diff --git a/test/integration/marked-spec.js b/test/specs/commonmark/commonmark-spec.js similarity index 83% rename from test/integration/marked-spec.js rename to test/specs/commonmark/commonmark-spec.js index 607ecb15df..30b8bea988 100644 --- a/test/integration/marked-spec.js +++ b/test/specs/commonmark/commonmark-spec.js @@ -1,5 +1,5 @@ -var marked = require('../../lib/marked.js'); -var cmSpec = require('./commonmark.json'); +var marked = require('../../../lib/marked.js'); +var cmSpec = require('./commonmark.0.28.json'); var HtmlDiffer = require('html-differ').HtmlDiffer, htmlDiffer = new HtmlDiffer(); var since = require('jasmine2-custom-message'); @@ -11,42 +11,44 @@ Messenger.prototype.message = function(spec, expected, actual) { } Messenger.prototype.test = function(spec, section, ignore) { - if (spec.section === section && ignore.indexOf(spec.example) < 0) { - it('should pass example ' + spec.example, function() { + 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(true); + ).toEqual(!shouldFail); }); } } var messenger = new Messenger(); /* -|Section |Count |Percent | -|:---------------------------|:-------:|---------:| -|Tabs |7 of 11 |63% | -|Thematic breaks |16 of 19 |84% | -|ATX headings |13 of 18 |72% | -|Setext headings |20 of 26 |77% | -|Indented code blocks |11 of 12 |92% | -|Fenced code blocks |17 of 28 |61% | -|HTML blocks |12 of 43 |28% | -|Link reference definitions |21 of 23 |91% | -|Paragraphs |6 of 8 |75% | -|Block quotes |21 of 25 |84% | -|List items |32 of 48 |67% | -|Lists |10 of 24 |42% | -|Backslash escapes |4 of 13 |31% | -|Entity and numeric character references|8 of 12|67%| -|Code spans |10 of 17 |59% | -|Emphasis and strong emphasis|62 of 128|48% | -|Links |46 of 84 |55% | -|Images |13 of 22 |59% | -|Autolinks |14 of 19 |74% | -|Hard line breaks |32 of 36 |89% | -|Soft line breaks |1 of 2 |50% | +|Section |Count |Percent | +|:---------------------------------------|:---------:|-------:| +|Tabs | 7 of 11 | 64%| +|Thematic breaks | 18 of 19 | 95%| +|ATX headings | 14 of 18 | 78%| +|Setext headings | 21 of 26 | 81%| +|Indented code blocks | 11 of 12 | 92%| +|Fenced code blocks | 17 of 28 | 61%| +|HTML blocks | 12 of 43 | 28%| +|Link reference definitions | 21 of 23 | 91%| +|Paragraphs | 6 of 8 | 75%| +|Block quotes | 21 of 25 | 84%| +|List items | 32 of 48 | 67%| +|Lists | 10 of 24 | 42%| +|Backslash escapes | 4 of 13 | 31%| +|Entity and numeric character references | 8 of 12 | 67%| +|Code spans | 10 of 17 | 59%| +|Emphasis and strong emphasis | 71 of 128 | 55%| +|Links | 45 of 84 | 54%| +|Images | 13 of 22 | 59%| +|Autolinks | 14 of 19 | 74%| +|Raw HTML | 13 of 21 | 62%| +|Hard line breaks | 32 of 36 | 89%| +|Soft line breaks | 1 of 2 | 50%| */ describe('CommonMark 0.28 Tabs', function() { @@ -169,7 +171,7 @@ describe('CommonMark 0.28 HTML blocks', function() { var section = 'HTML blocks'; // var shouldPassButFails = []; - var shouldPassButFails = [132, 126, 147, 121, 124, 120, 153, 133, 119, 127, 117, 118, 141, 116, 158, 122, 123, 128, 143, 130, 136, 137, 140, 125, 134, 131, 144, 145, 146, 148, 139, 149, 129, 156, 135, 138, 142, 150, 151, 152, 154, 155, 157]; + var shouldPassButFails = [132, 126, 147, 124, 120, 153, 133, 119, 127, 118, 141, 116, 158, 123, 143, 130, 137, 140, 125, 134, 131, 144, 145, 148, 139, 149, 129, 156, 135, 138, 155]; var willNotBeAttemptedByCoreTeam = []; @@ -259,7 +261,7 @@ describe('CommonMark 0.28 Lists', function() { var section = 'Lists'; // var shouldPassButFails = []; - var shouldPassButFails = [282, 270, 280, 278, 271, 272, 273, 275, 274, 264, 277, 265, 276, 279, 267, 269]; + var shouldPassButFails = [282, 270, 280, 278, 273, 275, 274, 264, 277, 265, 276, 279, 267, 269]; var willNotBeAttemptedByCoreTeam = []; @@ -319,7 +321,7 @@ describe('CommonMark 0.28 Code spans', function() { var section = 'Code spans'; // var shouldPassButFails = []; - var shouldPassButFails = [330, 316, 325, 327, 328, 320, 323, 322]; + var shouldPassButFails = [330, 316, 327, 328, 320, 323, 322]; var willNotBeAttemptedByCoreTeam = []; @@ -394,7 +396,7 @@ describe('CommonMark 0.28 Raw HTML', function() { var section = 'Raw HTML'; // var shouldPassButFails = []; - var shouldPassButFails = [584, 585, 586, 587, 588, 590, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604]; + var shouldPassButFails = [590, 595, 597, 598, 599, 600, 601, 604]; var willNotBeAttemptedByCoreTeam = []; @@ -409,7 +411,7 @@ describe('CommonMark 0.28 Hard line breaks', function() { var section = 'Hard line breaks'; // var shouldPassButFails = []; - var shouldPassButFails = [611, 606, 609, 613, 614, 615]; + var shouldPassButFails = [611, 606, 609, 613]; var willNotBeAttemptedByCoreTeam = []; diff --git a/test/integration/commonmark.json b/test/specs/commonmark/commonmark.0.28.json similarity index 100% rename from test/integration/commonmark.json rename to test/specs/commonmark/commonmark.0.28.json diff --git a/test/specs/specs-spec.js b/test/specs/original/specs-spec.js similarity index 87% rename from test/specs/specs-spec.js rename to test/specs/original/specs-spec.js index 65526c863c..2610b3bb55 100644 --- a/test/specs/specs-spec.js +++ b/test/specs/original/specs-spec.js @@ -1,4 +1,4 @@ -var specTests = require('../'); +var specTests = require('../../'); it('should run spec tests', function () { // hide output