Guard restore-parameter negative staging
This commit is contained in:
@@ -208,6 +208,17 @@ function writeG92PersistenceStaging(wasmDir, expectedWasmDir, targetInterp = int
|
||||
return { disabledIniPath, iniPath, parameterPath, programPath };
|
||||
}
|
||||
|
||||
function generatedParameterPath(wasmPath, expectedWasmPath) {
|
||||
assert.equal(wasmPath, expectedWasmPath, `parameter fixture ${expectedWasmPath} staging path drift`);
|
||||
return wasmPath;
|
||||
}
|
||||
|
||||
function writeGeneratedParameterFixture(wasmPath, expectedWasmPath, text, targetInterp = interp) {
|
||||
const checkedPath = generatedParameterPath(wasmPath, expectedWasmPath);
|
||||
targetInterp.writeTextFile(checkedPath, text);
|
||||
return checkedPath;
|
||||
}
|
||||
|
||||
function stageInterpIniContext(name, programFile = "test.ngc") {
|
||||
const sourceRootRel = `tests/interp/${name}`;
|
||||
const iniText = readFileSync(
|
||||
@@ -3724,12 +3735,15 @@ verifyExpectedOutput(
|
||||
);
|
||||
verifyExpectedOutput(
|
||||
"restore_parameters_missing_file",
|
||||
interp.restoreParameters("/work/missing.var"),
|
||||
interp.restoreParameters(generatedParameterPath("/work/missing.var", "/work/missing.var")),
|
||||
"restore_parameters=0",
|
||||
);
|
||||
|
||||
const outOfOrderParameterFilePath = "/work/out-of-order.var";
|
||||
interp.writeTextFile(outOfOrderParameterFilePath, "5220 1\n5161 2\n");
|
||||
const outOfOrderParameterFilePath = writeGeneratedParameterFixture(
|
||||
"/work/out-of-order.var",
|
||||
"/work/out-of-order.var",
|
||||
"5220 1\n5161 2\n",
|
||||
);
|
||||
verifyExpectedOutput(
|
||||
"restore_parameters_out_of_order",
|
||||
interp.restoreParameters(outOfOrderParameterFilePath),
|
||||
@@ -3739,8 +3753,11 @@ verifyExpectedOutput(
|
||||
].join("\n"),
|
||||
);
|
||||
|
||||
const missingRequiredParameterFilePath = "/work/missing-required.var";
|
||||
interp.writeTextFile(missingRequiredParameterFilePath, "5161 3.5\n5220 1\n");
|
||||
const missingRequiredParameterFilePath = writeGeneratedParameterFixture(
|
||||
"/work/missing-required.var",
|
||||
"/work/missing-required.var",
|
||||
"5161 3.5\n5220 1\n",
|
||||
);
|
||||
verifyExpectedOutput(
|
||||
"restore_parameters_missing_required",
|
||||
interp.restoreParameters(missingRequiredParameterFilePath),
|
||||
|
||||
Reference in New Issue
Block a user