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:
@@ -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 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);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user