2024-09-18 00:19:33 -07:00
|
|
|
import { fileTests as runTestFile } from '@lezer/generator/dist/test';
|
2024-05-10 09:49:22 -07:00
|
|
|
import fs from 'fs';
|
|
|
|
import path from 'path';
|
2024-09-18 00:19:33 -07:00
|
|
|
|
2024-05-10 09:49:22 -07:00
|
|
|
import { n8nLanguage } from '../../src/expressions/index';
|
|
|
|
|
|
|
|
describe('expressions language', () => {
|
|
|
|
const CASES_DIR = __dirname;
|
|
|
|
for (const testFile of fs.readdirSync(CASES_DIR)) {
|
|
|
|
if (!/\.txt$/.test(testFile)) continue;
|
|
|
|
|
|
|
|
const testFileName = /^[^\.]*/.exec(testFile)![0];
|
|
|
|
describe(testFileName, () => {
|
|
|
|
for (const { name, run } of runTestFile(
|
|
|
|
fs.readFileSync(path.join(CASES_DIR, testFile), 'utf8'),
|
|
|
|
testFile,
|
|
|
|
)) {
|
|
|
|
it(name, () => run(n8nLanguage.parser));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|