Skip to content

Commit

Permalink
fix: parser error
Browse files Browse the repository at this point in the history
  • Loading branch information
vighnesh153 committed Sep 2, 2024
1 parent 9912d67 commit c74e952
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,17 +231,25 @@ test('should parse tag with children', () => {
`);
});

test('should return error if incorrect token position', () => {
test('should render naked text node', () => {
const [parser, program] = parseProgram('manifest');

expect(parser.errors.length).toBe(0);
expect(program.statements.length).toBe(1);
expect(program.toString(0)).toMatchInlineSnapshot(`"manifest"`);
});

test('should return error if incorrect token position', () => {
const [parser, program] = parseProgram('?');

expect(parser.errors.length).toBe(1);
expect(parser.errors[0].serialized()).toStrictEqual({
culpritToken: {
columnNumber: 1,
lineNumber: 1,
tokenLiteral: 'manifest',
tokenLiteral: '?',
tokenType: {
value: 'IDENTIFIER',
value: '?',
},
},
errorType: 'UNEXPECTED_TOKEN',
Expand Down

0 comments on commit c74e952

Please sign in to comment.