193fb6ee3Sopenharmony_ciimport * as fs from 'node:fs';
293fb6ee3Sopenharmony_ciimport * as path from 'node:path';
393fb6ee3Sopenharmony_ciimport { normalizeNewLine } from './common.js';
493fb6ee3Sopenharmony_ci
593fb6ee3Sopenharmony_ciexport function loadSAXParserTestData(): { name: string; src: string; expected: string }[] {
693fb6ee3Sopenharmony_ci    const dataDirPath = new URL('../data/sax', import.meta.url);
793fb6ee3Sopenharmony_ci    const testSetFileDirs = fs.readdirSync(dataDirPath);
893fb6ee3Sopenharmony_ci
993fb6ee3Sopenharmony_ci    return testSetFileDirs.map((dirName) => {
1093fb6ee3Sopenharmony_ci        const srcFilePath = path.join(dataDirPath.pathname, dirName, 'src.html');
1193fb6ee3Sopenharmony_ci        const expectedFilePath = path.join(dataDirPath.pathname, dirName, 'expected.html');
1293fb6ee3Sopenharmony_ci        const src = fs.readFileSync(srcFilePath).toString();
1393fb6ee3Sopenharmony_ci        const expected = fs.readFileSync(expectedFilePath).toString();
1493fb6ee3Sopenharmony_ci
1593fb6ee3Sopenharmony_ci        return {
1693fb6ee3Sopenharmony_ci            name: dirName,
1793fb6ee3Sopenharmony_ci            src: normalizeNewLine(src),
1893fb6ee3Sopenharmony_ci            expected: normalizeNewLine(expected),
1993fb6ee3Sopenharmony_ci        };
2093fb6ee3Sopenharmony_ci    });
2193fb6ee3Sopenharmony_ci}
22