Skip to content

Commit a500eae

Browse files
authored
Merge pull request #1213 from UziTech/test-folders
Test folders
2 parents bf04217 + 5b8ca09 commit a500eae

File tree

4 files changed

+37
-35
lines changed

4 files changed

+37
-35
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
"test": "jasmine --config=jasmine.json",
4444
"test:unit": "npm test -- test/unit/**/*-spec.js",
4545
"test:specs": "npm test -- test/specs/**/*-spec.js",
46+
"test:cm": "npm test -- test/specs/commonmark/**/*-spec.js",
4647
"test:gfm": "npm test -- test/specs/gfm/**/*-spec.js",
47-
"test:integration": "npm test -- test/integration/**/*-spec.js",
4848
"test:old": "node test",
4949
"test:lint": "eslint bin/marked .",
5050
"bench": "node test --bench",

test/integration/marked-spec.js renamed to test/specs/commonmark/commonmark-spec.js

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
var marked = require('../../lib/marked.js');
2-
var cmSpec = require('./commonmark.json');
1+
var marked = require('../../../lib/marked.js');
2+
var cmSpec = require('./commonmark.0.28.json');
33
var HtmlDiffer = require('html-differ').HtmlDiffer,
44
htmlDiffer = new HtmlDiffer();
55
var since = require('jasmine2-custom-message');
@@ -11,42 +11,44 @@ Messenger.prototype.message = function(spec, expected, actual) {
1111
}
1212

1313
Messenger.prototype.test = function(spec, section, ignore) {
14-
if (spec.section === section && ignore.indexOf(spec.example) < 0) {
15-
it('should pass example ' + spec.example, function() {
14+
if (spec.section === section) {
15+
var shouldFail = ~ignore.indexOf(spec.example);
16+
it('should ' + (shouldFail ? 'fail' : 'pass') + ' example ' + spec.example, function() {
1617
var expected = spec.html;
1718
var actual = marked(spec.markdown, { headerIds: false, xhtml: true });
1819
since(messenger.message(spec, expected, actual)).expect(
1920
htmlDiffer.isEqual(expected, actual)
20-
).toEqual(true);
21+
).toEqual(!shouldFail);
2122
});
2223
}
2324
}
2425

2526
var messenger = new Messenger();
2627
/*
27-
|Section |Count |Percent |
28-
|:---------------------------|:-------:|---------:|
29-
|Tabs |7 of 11 |63% |
30-
|Thematic breaks |16 of 19 |84% |
31-
|ATX headings |13 of 18 |72% |
32-
|Setext headings |20 of 26 |77% |
33-
|Indented code blocks |11 of 12 |92% |
34-
|Fenced code blocks |17 of 28 |61% |
35-
|HTML blocks |12 of 43 |28% |
36-
|Link reference definitions |21 of 23 |91% |
37-
|Paragraphs |6 of 8 |75% |
38-
|Block quotes |21 of 25 |84% |
39-
|List items |32 of 48 |67% |
40-
|Lists |10 of 24 |42% |
41-
|Backslash escapes |4 of 13 |31% |
42-
|Entity and numeric character references|8 of 12|67%|
43-
|Code spans |10 of 17 |59% |
44-
|Emphasis and strong emphasis|62 of 128|48% |
45-
|Links |46 of 84 |55% |
46-
|Images |13 of 22 |59% |
47-
|Autolinks |14 of 19 |74% |
48-
|Hard line breaks |32 of 36 |89% |
49-
|Soft line breaks |1 of 2 |50% |
28+
|Section |Count |Percent |
29+
|:---------------------------------------|:---------:|-------:|
30+
|Tabs | 7 of 11 | 64%|
31+
|Thematic breaks | 18 of 19 | 95%|
32+
|ATX headings | 14 of 18 | 78%|
33+
|Setext headings | 21 of 26 | 81%|
34+
|Indented code blocks | 11 of 12 | 92%|
35+
|Fenced code blocks | 17 of 28 | 61%|
36+
|HTML blocks | 12 of 43 | 28%|
37+
|Link reference definitions | 21 of 23 | 91%|
38+
|Paragraphs | 6 of 8 | 75%|
39+
|Block quotes | 21 of 25 | 84%|
40+
|List items | 32 of 48 | 67%|
41+
|Lists | 10 of 24 | 42%|
42+
|Backslash escapes | 4 of 13 | 31%|
43+
|Entity and numeric character references | 8 of 12 | 67%|
44+
|Code spans | 10 of 17 | 59%|
45+
|Emphasis and strong emphasis | 71 of 128 | 55%|
46+
|Links | 45 of 84 | 54%|
47+
|Images | 13 of 22 | 59%|
48+
|Autolinks | 14 of 19 | 74%|
49+
|Raw HTML | 13 of 21 | 62%|
50+
|Hard line breaks | 32 of 36 | 89%|
51+
|Soft line breaks | 1 of 2 | 50%|
5052
*/
5153

5254
describe('CommonMark 0.28 Tabs', function() {
@@ -169,7 +171,7 @@ describe('CommonMark 0.28 HTML blocks', function() {
169171
var section = 'HTML blocks';
170172

171173
// var shouldPassButFails = [];
172-
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];
174+
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];
173175

174176
var willNotBeAttemptedByCoreTeam = [];
175177

@@ -259,7 +261,7 @@ describe('CommonMark 0.28 Lists', function() {
259261
var section = 'Lists';
260262

261263
// var shouldPassButFails = [];
262-
var shouldPassButFails = [282, 270, 280, 278, 271, 272, 273, 275, 274, 264, 277, 265, 276, 279, 267, 269];
264+
var shouldPassButFails = [282, 270, 280, 278, 273, 275, 274, 264, 277, 265, 276, 279, 267, 269];
263265

264266
var willNotBeAttemptedByCoreTeam = [];
265267

@@ -319,7 +321,7 @@ describe('CommonMark 0.28 Code spans', function() {
319321
var section = 'Code spans';
320322

321323
// var shouldPassButFails = [];
322-
var shouldPassButFails = [330, 316, 325, 327, 328, 320, 323, 322];
324+
var shouldPassButFails = [330, 316, 327, 328, 320, 323, 322];
323325

324326
var willNotBeAttemptedByCoreTeam = [];
325327

@@ -394,7 +396,7 @@ describe('CommonMark 0.28 Raw HTML', function() {
394396
var section = 'Raw HTML';
395397

396398
// var shouldPassButFails = [];
397-
var shouldPassButFails = [584, 585, 586, 587, 588, 590, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604];
399+
var shouldPassButFails = [590, 595, 597, 598, 599, 600, 601, 604];
398400

399401
var willNotBeAttemptedByCoreTeam = [];
400402

@@ -409,7 +411,7 @@ describe('CommonMark 0.28 Hard line breaks', function() {
409411
var section = 'Hard line breaks';
410412

411413
// var shouldPassButFails = [];
412-
var shouldPassButFails = [611, 606, 609, 613, 614, 615];
414+
var shouldPassButFails = [611, 606, 609, 613];
413415

414416
var willNotBeAttemptedByCoreTeam = [];
415417

test/specs/specs-spec.js renamed to test/specs/original/specs-spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var specTests = require('../');
1+
var specTests = require('../../');
22

33
it('should run spec tests', function () {
44
// hide output

0 commit comments

Comments
 (0)