parser-combinator
Version:
Parser combinators
77 lines (63 loc) • 2.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _codeLineParser = require('../../../lib/standard/markdown/code-line-parser');
var _codeLineParser2 = _interopRequireDefault(_codeLineParser);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var value = undefined; /**
* Created by Simon on 03/01/2017.
*/
var accepted = undefined;
var expected = undefined;
function testLine(line) {
var parsing = _codeLineParser2.default.parse(line);
value = parsing.value;
accepted = parsing.isAccepted();
}
exports.default = {
setUp: function setUp(done) {
done();
},
'test text normal': function testTextNormal(test) {
var line = 'This is not a code';
testLine(line);
test.ok(!accepted, ' Normal text should not be accepted as a code block');
test.done();
},
'test bullet': function testBullet(test) {
var line = '\t This is a level2 bullet';
testLine(line);
test.ok(!accepted, 'bullets should not be accepted as a code block');
test.done();
},
'test code 1': function testCode1(test) {
var line = ' This is a code block\n';
testLine(line);
expected = { code: 'This is a code block' };
test.deepEqual(value, expected, 'This is a gentle block code');
test.done();
},
'test code 2': function testCode2(test) {
var line = '\t\t This is a code block';
testLine(line);
expected = { code: ' This is a code block' };
test.deepEqual(value, expected, ' This is a block code stzrting with spaces and ending with eos');
test.done();
},
'test code 3': function testCode3(test) {
var line = '\t\t';
testLine(line);
expected = { code: '' };
test.deepEqual(value, expected, ' This is a blank line in a code');
test.done();
},
'test code 4': function testCode4(test) {
var line = '\t\t ';
testLine(line);
expected = { code: ' ' };
test.deepEqual(value, expected, ' This is a code line with only 2 spaces');
test.done();
}
};
//# sourceMappingURL=code-line-parser-test.js.map