Split wasm tests for next parse state
This commit is contained in:
parent
ec90c215ae
commit
ab788619ca
1 changed files with 13 additions and 4 deletions
|
|
@ -326,10 +326,10 @@ describe("Node", () => {
|
|||
);
|
||||
});
|
||||
|
||||
describe(".parseState", () => {
|
||||
describe(".parseState, .nextParseState", () => {
|
||||
const text = "10 / 5";
|
||||
|
||||
it(`returns node parse state ids`, async () => {
|
||||
it("returns node parse state ids", async () => {
|
||||
tree = await parser.parse(text)
|
||||
const quotientNode = tree.rootNode.firstChild.firstChild;
|
||||
const [numerator, slash, denominator] = quotientNode.children;
|
||||
|
|
@ -338,11 +338,20 @@ describe("Node", () => {
|
|||
// parse states will change on any change to the grammar so test that it
|
||||
// returns something instead
|
||||
assert.isAbove(numerator.parseState, 0);
|
||||
assert.isAbove(numerator.nextParseState, 0);
|
||||
assert.isAbove(slash.parseState, 0);
|
||||
assert.isAbove(denominator.parseState, 0);
|
||||
assert.isAbove(denominator.nextParseState, 0);
|
||||
})
|
||||
|
||||
it("returns next parse state equal to the language", async () => {
|
||||
tree = await parser.parse(text);
|
||||
const quotientNode = tree.rootNode.firstChild.firstChild;
|
||||
quotientNode.children.forEach(node => {
|
||||
assert.equal(
|
||||
node.nextParseState,
|
||||
JavaScript.nextState(node.parseState, node.grammarId)
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('.descendantsOfType(type, min, max)', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue