Test(emphasis): prove that emphasis mechanism is working correctly

This test scenario is related to issue #107
This commit is contained in:
Estevão Soares dos Santos 2015-01-16 23:05:12 +00:00
parent f938d2b8aa
commit d4f619c666
3 changed files with 68 additions and 29 deletions

View File

@ -0,0 +1,11 @@
<p>escaped word_with_underscores</p>
<p>escaped word__with__double underscores</p>
<p>escaped word<em>_with_</em>single italic underscore</p>
<p>escaped word*with*asterixs</p>
<p>escaped word**with**asterixs</p>
<p>escaped word<strong>*with*</strong>bold asterixs</p>

View File

@ -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

View File

@ -9,16 +9,40 @@
require('chai').should();
var fs = require('fs'),
dir = 'test/cases/',
showdown = require('../../../dist/showdown.js'),
converter = new showdown.Converter();
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) {
//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');
}).map(function (file) {
};
}
function map(dir) {
return function(file) {
var name = file.replace('.md', ''),
htmlPath = dir + name + '.html',
html = fs.readFileSync(htmlPath, 'utf8'),
@ -30,7 +54,8 @@
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]));
}
});
})();