MCPcopy
hub / github.com/webpack/webpack / loadTokenizerCases

Function loadTokenizerCases

test/html5lib.spectest.js:54–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

52 * @returns {{ id: string, input: string }[]} every Data-state tokenizer input
53 */
54const loadTokenizerCases = () => {
55 const cases = [];
56 for (const file of fs.readdirSync(tokenizerDir)) {
57 if (!file.endsWith(".test") || SKIP_FILES.has(file)) continue;
58 const data = JSON.parse(
59 fs.readFileSync(path.join(tokenizerDir, file), "utf8")
60 );
61 let index = 0;
62 for (const t of data.tests || []) {
63 if (!(t.initialStates || ["Data state"]).includes("Data state")) continue;
64 const input = t.doubleEscaped ? unescape(t.input) : t.input;
65 cases.push({ id: `${file} #${index}`, input });
66 index++;
67 }
68 }
69 return cases;
70};
71
72/**
73 * Compile a batch of inputs as separate HTML entries in one compilation.

Callers 1

Calls 4

unescapeFunction · 0.85
hasMethod · 0.45
parseMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected