Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed Aug 24, 2024
1 parent eddf4ab commit 5608597
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/__tests__/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,23 @@ describe('parse', () => {
}).toThrow();
});

it('parses escaped characters', () => {
let ast = parse(`
{ field(arg: "Has another \\\\x sequence.") }
`);
expect(ast).toHaveProperty(
'definitions.0.selectionSet.selections.0.arguments.0.value.value',
'Has another \\x sequence.'
);
ast = parse(`
{ field(arg: "Has a \\\\x sequence.") }
`);
expect(ast).toHaveProperty(
'definitions.0.selectionSet.selections.0.arguments.0.value.value',
'Has a \\x sequence.'
);
});

it('parses multi-byte characters', () => {
// Note: \u0A0A could be naively interpreted as two line-feed chars.
const ast = parse(`
Expand Down

0 comments on commit 5608597

Please sign in to comment.