From c42c77f57d2df4f84636375e8eb9b5dfd9f31971 Mon Sep 17 00:00:00 2001 From: Lukas Pietzschmann Date: Tue, 8 Oct 2024 15:24:00 +0200 Subject: [PATCH] test: added test for normalized ast query --- .../dataflow/query/normalized-ast-query-tests.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/functionality/dataflow/query/normalized-ast-query-tests.ts diff --git a/test/functionality/dataflow/query/normalized-ast-query-tests.ts b/test/functionality/dataflow/query/normalized-ast-query-tests.ts new file mode 100644 index 0000000000..b646ac0b28 --- /dev/null +++ b/test/functionality/dataflow/query/normalized-ast-query-tests.ts @@ -0,0 +1,15 @@ +import { assertQuery } from '../../_helper/query'; +import { label } from '../../_helper/label'; +import { withShell } from '../../_helper/shell'; +import type { + NormalizedAstQuery +} from '../../../../src/queries/catalog/normalized-ast-query/normalized-ast-query-format'; + +describe('Normalized AST Query', withShell(shell => { + function testQuery(name: string, code: string, query: readonly NormalizedAstQuery[]) { + assertQuery(label(name), shell, code, query, ({ normalize }) => ({ 'normalized-ast': { normalized: normalize } })); + } + + testQuery('Single AST', 'x + 1', [{ type: 'normalized-ast' }]); + testQuery('Multiple Queries', 'x + 1', [{ type: 'normalized-ast' }, { type: 'normalized-ast' }, { type: 'normalized-ast' }]); +}));