Guard fixture loop staging
This commit is contained in:
@@ -124,6 +124,15 @@ function writeLocalGcodeFixture(fixtureName, wasmPath, expectedWasmPath, targetI
|
||||
return wasmPath;
|
||||
}
|
||||
|
||||
function writeLocalErrorGcodeFixture(fixtureName, wasmPath, expectedWasmPath, targetInterp = interp) {
|
||||
assert.equal(wasmPath, expectedWasmPath, `${fixtureName} local error gcode staging path drift`);
|
||||
targetInterp.writeTextFile(
|
||||
wasmPath,
|
||||
readFileSync(resolve(rootDir, `tests/fixtures/gcode_errors/${fixtureName}.ngc`), "utf8"),
|
||||
);
|
||||
return wasmPath;
|
||||
}
|
||||
|
||||
function stageInterpIniContext(name, programFile = "test.ngc") {
|
||||
const sourceRootRel = `tests/interp/${name}`;
|
||||
const iniText = readFileSync(
|
||||
@@ -684,32 +693,30 @@ for (const fixtureName of INTERP_ERROR_FIXTURES) {
|
||||
}
|
||||
|
||||
for (const fixtureName of INTERP_ERROR_FIXTURES) {
|
||||
const programPath = `/work/${fixtureName}-error.ngc`;
|
||||
const programText = readFileSync(
|
||||
resolve(rootDir, `tests/fixtures/gcode_errors/${fixtureName}.ngc`),
|
||||
"utf8",
|
||||
const programPath = writeLocalErrorGcodeFixture(
|
||||
fixtureName,
|
||||
`/work/${fixtureName}-error.ngc`,
|
||||
`/work/${fixtureName}-error.ngc`,
|
||||
);
|
||||
const expectedOutput = readFileSync(
|
||||
resolve(rootDir, `tests/fixtures/canon_errors/${fixtureName}.expected`),
|
||||
"utf8",
|
||||
).trimEnd();
|
||||
|
||||
interp.writeTextFile(programPath, programText);
|
||||
verifyExpectedFileError(fixtureName, interp.runFile(programPath), expectedOutput);
|
||||
}
|
||||
|
||||
for (const fixtureName of INTERP_FILE_FIXTURES) {
|
||||
const programPath = `/work/${fixtureName}.ngc`;
|
||||
const programText = readFileSync(
|
||||
resolve(rootDir, `tests/fixtures/gcode/${fixtureName}.ngc`),
|
||||
"utf8",
|
||||
const programPath = writeLocalGcodeFixture(
|
||||
fixtureName,
|
||||
`/work/${fixtureName}.ngc`,
|
||||
`/work/${fixtureName}.ngc`,
|
||||
);
|
||||
const expectedEvents = readFileSync(
|
||||
resolve(rootDir, `tests/fixtures/canon/${fixtureName}.events`),
|
||||
"utf8",
|
||||
).trimEnd();
|
||||
|
||||
interp.writeTextFile(programPath, programText);
|
||||
verifyExpectedOutput(fixtureName, interp.runFile(programPath), expectedEvents);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user