refactor(wasm)!: make current*, is*, and has* methods properties
This commit is contained in:
parent
4b578a3649
commit
c070c92722
6 changed files with 54 additions and 54 deletions
|
|
@ -251,7 +251,7 @@ describe('Node', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('.hasError()', () => {
|
||||
describe('.hasError', () => {
|
||||
it('returns true if the node contains an error', () => {
|
||||
tree = parser.parse('1 + 2 * * 3');
|
||||
const node = tree.rootNode;
|
||||
|
|
@ -261,14 +261,14 @@ describe('Node', () => {
|
|||
);
|
||||
|
||||
const sum = node.firstChild.firstChild;
|
||||
assert(sum.hasError());
|
||||
assert(!sum.children[0].hasError());
|
||||
assert(!sum.children[1].hasError());
|
||||
assert(sum.children[2].hasError());
|
||||
assert(sum.hasError);
|
||||
assert(!sum.children[0].hasError);
|
||||
assert(!sum.children[1].hasError);
|
||||
assert(sum.children[2].hasError);
|
||||
});
|
||||
});
|
||||
|
||||
describe('.isError()', () => {
|
||||
describe('.isError', () => {
|
||||
it('returns true if the node is an error', () => {
|
||||
tree = parser.parse('2 * * 3');
|
||||
const node = tree.rootNode;
|
||||
|
|
@ -278,15 +278,15 @@ describe('Node', () => {
|
|||
);
|
||||
|
||||
const multi = node.firstChild.firstChild;
|
||||
assert(multi.hasError());
|
||||
assert(!multi.children[0].isError());
|
||||
assert(!multi.children[1].isError());
|
||||
assert(multi.children[2].isError());
|
||||
assert(!multi.children[3].isError());
|
||||
assert(multi.hasError);
|
||||
assert(!multi.children[0].isError);
|
||||
assert(!multi.children[1].isError);
|
||||
assert(multi.children[2].isError);
|
||||
assert(!multi.children[3].isError);
|
||||
});
|
||||
});
|
||||
|
||||
describe('.isMissing()', () => {
|
||||
describe('.isMissing', () => {
|
||||
it('returns true if the node is missing from the source and was inserted via error recovery', () => {
|
||||
tree = parser.parse('(2 ||)');
|
||||
const node = tree.rootNode;
|
||||
|
|
@ -297,10 +297,10 @@ describe('Node', () => {
|
|||
|
||||
const sum = node.firstChild.firstChild.firstNamedChild;
|
||||
assert.equal(sum.type, 'binary_expression');
|
||||
assert(sum.hasError());
|
||||
assert(!sum.children[0].isMissing());
|
||||
assert(!sum.children[1].isMissing());
|
||||
assert(sum.children[2].isMissing());
|
||||
assert(sum.hasError);
|
||||
assert(!sum.children[0].isMissing);
|
||||
assert(!sum.children[1].isMissing);
|
||||
assert(sum.children[2].isMissing);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue