Skip to content

Commit e670b46

Browse files
committed
test(expressions): use validate
1 parent dbf7550 commit e670b46

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

apps/parser/test/integration/expressions.test.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as TestSubject from '@encode/parser/lib';
2-
import { assert, assertEquals, assertGreater } from '@std/assert';
2+
import { v } from '@encode/parser/lib';
3+
import { assert, assertEquals } from '@std/assert';
34
import { performParsingTestCase, useGlobalSettings } from '@/test/utils/mod.ts';
45

56
Deno.test('Expression parsing #integration', async (t) => {
@@ -25,8 +26,21 @@ Deno.test('Expression parsing #integration', async (t) => {
2526

2627
assert(parser.errors.length === 0, 'Parser should not error');
2728

28-
assert(parserOutput.statement);
29-
assertGreater(parserOutput.statement.length, 0, 'Statements should be generated');
29+
v.file(parserOutput, [
30+
[
31+
'declaration',
32+
[
33+
'a',
34+
v.none,
35+
[
36+
['nested', [['constant', ['INT', '1']], v.none, '*', [['constant', ['INT', '2']]]]],
37+
v.none,
38+
'+',
39+
[['constant', ['INT', '3']]],
40+
],
41+
],
42+
],
43+
]);
3044

3145
assertEquals(precOutput, 1, 'Expression should be reordered');
3246
});

0 commit comments

Comments
 (0)