Skip to content

Commit

Permalink
Fix RegEx flag tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aabounegm committed Jul 27, 2024
1 parent d7c27a7 commit efc7872
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/langium/test/parser/token-builder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,22 @@ describe('tokenBuilder#flagsForRegex', () => {
const tokens = await getTokens(`
grammar test
entry Main: a=A;
terminal A: /A/is;
terminal A: /A/i;
`);
const tokenA = tokens[0];
expect(tokenA.PATTERN).toEqual(/A/is);
expect(tokenA.PATTERN).toEqual(/A/i);
});

test('Uses custom matcher for flags not supported by Chevrotain', async () => {
const tokens = await getTokens(`
grammar test
entry Main: a=A | b=B;
terminal A: /A/s;
terminal B: /B/u;
`);
const [tokenA, tokenB] = tokens;
expect(tokenA.PATTERN).toBeTypeOf('function');
expect(tokenB.PATTERN).toBeTypeOf('function');
});

test('Ignores invalid flags', async () => {
Expand Down

0 comments on commit efc7872

Please sign in to comment.