import { parser } from '../parser';
import { fileTests } from 'lezer-generator/dist/test';

import * as fs from 'fs';
import * as path from 'path';

const caseDir = './src/lang-promql/grammar/test';
for (const file of fs.readdirSync(caseDir)) {
  if (!/\.txt$/.test(file)) continue;

  const name = /^[^\.]*/.exec(file)[0];
  describe(name, () => {
    for (const { name, run } of fileTests(fs.readFileSync(path.join(caseDir, file), 'utf8'), file)) it(name, () => run(parser));
  });
}
