Skip to content

Commit

Permalink
add test for location
Browse files Browse the repository at this point in the history
  • Loading branch information
uzmoi committed May 5, 2024
1 parent ce9fec1 commit 7ae0774
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2399,6 +2399,20 @@ describe('Location', () => {
if (!node.loc) assert.fail();
assert.deepEqual(node.loc, { start: 3, end: 13 });
});
test.concurrent('comment', async () => {
let node: Ast.Node;
const parser = new Parser();
const nodes = parser.parse(`
/*
*/
// hoge
@f(a) { a }
`);
assert.equal(nodes.length, 1);
node = nodes[0];
if (!node.loc) assert.fail();
assert.deepEqual(node.loc, { start: 23, end: 33 });
});
});

describe('Variable declaration', () => {
Expand Down

0 comments on commit 7ae0774

Please sign in to comment.