diff --git a/test/issues/#107.inner_underscore_parse_to_block.html b/test/issues/#107.inner_underscore_parse_to_block.html new file mode 100644 index 0000000..b47ea95 --- /dev/null +++ b/test/issues/#107.inner_underscore_parse_to_block.html @@ -0,0 +1,11 @@ +
escaped word_with_underscores
+ +escaped word__with__double underscores
+ +escaped word_with_single italic underscore
+ +escaped word*with*asterixs
+ +escaped word**with**asterixs
+ +escaped word*with*bold asterixs
diff --git a/test/issues/#107.inner_underscore_parse_to_block.md b/test/issues/#107.inner_underscore_parse_to_block.md new file mode 100644 index 0000000..8d22521 --- /dev/null +++ b/test/issues/#107.inner_underscore_parse_to_block.md @@ -0,0 +1,11 @@ +escaped word\_with\_underscores + +escaped word\_\_with\_\_double underscores + +escaped word_\_with\__single italic underscore + +escaped word\*with*asterixs + +escaped word\*\*with\*\*asterixs + +escaped word**\*with\***bold asterixs diff --git a/test/node/Container/testMakeHtml.js b/test/node/Container/testMakeHtml.js index 0918bff..589d211 100644 --- a/test/node/Container/testMakeHtml.js +++ b/test/node/Container/testMakeHtml.js @@ -8,30 +8,55 @@ require('source-map-support').install(); require('chai').should(); - var fs = require('fs'), - dir = 'test/cases/', - showdown = require('../../../dist/showdown.js'), - converter = new showdown.Converter(); + var fs = require('fs'), + showdown = require('../../../dist/showdown.js'), + converter = new showdown.Converter(), + cases = fs + .readdirSync('test/cases/') + .filter(filter()) + .map(map('test/cases/')), + issues = fs + .readdirSync('test/issues/') + .filter(filter()) + .map(map('test/issues/')); - // Load test cases from disk - var cases = fs.readdirSync(dir).filter(function (file) { - var ext = file.slice(-3); - return (ext === '.md'); - }).map(function (file) { - - var name = file.replace('.md', ''), - htmlPath = dir + name + '.html', - html = fs.readFileSync(htmlPath, 'utf8'), - mdPath = dir + name + '.md', - md = fs.readFileSync(mdPath, 'utf8'); - - return { - name: name, - input: md, - expected: html - }; + //Tests + describe('Converter.makeHtml() simple testcases', function () { + for (var i = 0; i < cases.length; ++i) { + it(cases[i].name, assertion(cases[i])); + } }); + describe('Converter.makeHtml() issues testcase', function () { + for (var i = 0; i < issues.length; ++i) { + it(issues[i].name, assertion(issues[i])); + } + }); + + + function filter() { + return function(file) { + var ext = file.slice(-3); + return (ext === '.md'); + }; + } + + function map(dir) { + return function(file) { + var name = file.replace('.md', ''), + htmlPath = dir + name + '.html', + html = fs.readFileSync(htmlPath, 'utf8'), + mdPath = dir + name + '.md', + md = fs.readFileSync(mdPath, 'utf8'); + + return { + name: name, + input: md, + expected: html + }; + }; + } + //Normalize input/output function normalize(testCase) { @@ -69,12 +94,4 @@ testCase.actual.should.equal(testCase.expected); }; } - - //Tests - describe('Converter.makeHtml()', function () { - for (var i = 0; i < cases.length; ++i) { - it(cases[i].name, assertion(cases[i])); - } - }); - })();