2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-05 16:42:27 +03:00

add Tokenizer tests

This commit is contained in:
Nikolay Kostyurin
2018-06-09 00:06:36 +02:00
parent d739ec8ffd
commit 5e34dd9d43
9 changed files with 232 additions and 94 deletions
+20 -4
View File
@@ -1,9 +1,7 @@
const parse = require('./index');
const OldParser = require('./benchmark/OldParser');
const tabText = require('./benchmark/test/stub');
const options = {
closableTags: ['ch', 'syllable', 'tab'],
allowOnlyTags: ['ch', 'syllable', 'tab'],
};
@@ -15,8 +13,26 @@ describe("parse", () => {
});
test("same as old parser", () => {
const ast1 = parse(tabText, options);
const ast2 = OldParser.parse(tabText);
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 aint 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 Ill come alive
`;
const ast1 = parse(input, options);
const ast2 = OldParser.parse(input);
expect(ast1).toEqual(ast2);
})