mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-08 17:22:26 +03:00
more Tokenizer invalid cases tests
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
const parse = require('./index');
|
||||
const OldParser = require('./benchmark/OldParser');
|
||||
|
||||
const options = {
|
||||
allowOnlyTags: ['ch', 'syllable', 'tab'],
|
||||
@@ -12,28 +11,27 @@ describe("parse", () => {
|
||||
expect(ast).toEqual([{tag: 'Verse 2', attrs: {}, content: []}]);
|
||||
});
|
||||
|
||||
test("same as old parser", () => {
|
||||
const input = `[Verse 2]
|
||||
[ch]Eb[/ch] [ch]Fm[/ch]
|
||||
I'm walking around
|
||||
[ch]Ab[/ch] [ch]Cm[/ch]
|
||||
With my little raincloud
|
||||
[ch]Eb[/ch] [ch]Fm[/ch]
|
||||
Hanging over my head
|
||||
[ch]Cm[/ch] [ch]Ab[/ch]
|
||||
And it ain’t coming down
|
||||
[ch]Eb[/ch] [ch]Fm[/ch]
|
||||
Where do I go?
|
||||
[ch]Ab[/ch] [ch]Cm[/ch]
|
||||
Gimme some sort of sign
|
||||
[ch]Eb[/ch] [ch]Fm[/ch]
|
||||
Hit me with lightning!
|
||||
[ch]Cm[/ch] [ch]Ab[/ch]
|
||||
Maybe I’ll come alive
|
||||
`;
|
||||
const ast1 = parse(input, options);
|
||||
const ast2 = OldParser.parse(input);
|
||||
|
||||
expect(ast1).toEqual(ast2);
|
||||
})
|
||||
// test("pass invalid tags", () => {
|
||||
// const inputs = [
|
||||
// '[]',
|
||||
// '',
|
||||
// 'x html([a. title][, alt][, classes]) x',
|
||||
// '[/y]',
|
||||
// '[sc',
|
||||
// '[sc / [/sc]',
|
||||
// '[sc arg="val',
|
||||
// ];
|
||||
//
|
||||
// const ast1 = parse(inputs[0]);
|
||||
//
|
||||
//
|
||||
//
|
||||
// console.log('ast1', ast1);
|
||||
//
|
||||
//
|
||||
//
|
||||
// expect(ast1).toEqual([
|
||||
//
|
||||
// ]);
|
||||
// })
|
||||
});
|
||||
Reference in New Issue
Block a user