Add bad exists interpreter error fixtures

This commit is contained in:
2026-06-09 08:09:33 +08:00
parent 45420b055a
commit 50757e45ba
14 changed files with 173 additions and 2 deletions

View File

@@ -1564,6 +1564,55 @@
);
for (const badFixture of [
{
name: "exists_1",
file: "exists-1.ngc",
readCount: 2,
executeCount: 1,
errorText: "Expected # reading parameter",
},
{
name: "exists_2",
file: "exists-2.ngc",
readCount: 2,
executeCount: 1,
errorText: "Expected ] reading bracketed parameter",
},
{
name: "exists_3",
file: "exists-3.ngc",
readCount: 3,
executeCount: 2,
errorText: "Parameter number out of range",
},
{
name: "exists_4",
file: "exists-4.ngc",
readCount: 2,
executeCount: 1,
errorText: "Unknown word starting with f",
},
{
name: "exists_5",
file: "exists-5.ngc",
readCount: 2,
executeCount: 1,
errorText: "Named parameter not terminated",
},
{
name: "exists_6",
file: "exists-6.ngc",
readCount: 2,
executeCount: 1,
errorText: "bad number format (conversion failed) parsing ''",
},
{
name: "exists_7",
file: "exists-7.ngc",
readCount: 2,
executeCount: 1,
errorText: "Expected ] reading bracketed parameter",
},
{
name: "nested",
file: "nested.ngc",

View File

@@ -211,6 +211,13 @@ check_exitcode linuxcnc_interp_minimal_harness.subs_follow_main.run
check_exitcode linuxcnc_interp_minimal_harness.fractional_linenumbers.run
check_exitcode linuxcnc_interp_minimal_harness.namedparam_bug424.run
check_exitcode linuxcnc_interp_minimal_harness.flowsnake.run
check_exitcode linuxcnc_interp_minimal_harness.bad_exists_1.run
check_exitcode linuxcnc_interp_minimal_harness.bad_exists_2.run
check_exitcode linuxcnc_interp_minimal_harness.bad_exists_3.run
check_exitcode linuxcnc_interp_minimal_harness.bad_exists_4.run
check_exitcode linuxcnc_interp_minimal_harness.bad_exists_5.run
check_exitcode linuxcnc_interp_minimal_harness.bad_exists_6.run
check_exitcode linuxcnc_interp_minimal_harness.bad_exists_7.run
check_exitcode linuxcnc_interp_minimal_harness.bad_nested.run
check_exitcode linuxcnc_interp_minimal_harness.bad_no_feed_rate.run
check_exitcode linuxcnc_interp_minimal_harness.bad_no_ijr.run
@@ -1151,6 +1158,29 @@ grep -Fq "setup.current_x=0.25" "$FLOWSNAKE_STDOUT"
grep -Fq "setup.current_y=1" "$FLOWSNAKE_STDOUT"
grep -Fq "setup.current_z=1" "$FLOWSNAKE_STDOUT"
check_bad_file_fixture() {
local name="$1"
local read_count="$2"
local execute_count="$3"
local error_text="$4"
local stdout_file="$BUILD_DIR/linuxcnc_interp_minimal_harness.$name.run.stdout.log"
grep -Fq "file_open=0" "$stdout_file"
grep -Fq "file_read_count=$read_count" "$stdout_file"
grep -Fq "file_execute_count=$execute_count" "$stdout_file"
grep -Fq "file_saw_error=1" "$stdout_file"
grep -Fq "file_error_text=$error_text" "$stdout_file"
grep -Fq "canon_event=ON_RESET" "$stdout_file"
}
check_bad_file_fixture bad_exists_1 2 1 "Expected # reading parameter"
check_bad_file_fixture bad_exists_2 2 1 "Expected ] reading bracketed parameter"
check_bad_file_fixture bad_exists_3 3 2 "Parameter number out of range"
check_bad_file_fixture bad_exists_4 2 1 "Unknown word starting with f"
check_bad_file_fixture bad_exists_5 2 1 "Named parameter not terminated"
check_bad_file_fixture bad_exists_6 2 1 "bad number format (conversion failed) parsing ''"
check_bad_file_fixture bad_exists_7 2 1 "Expected ] reading bracketed parameter"
BAD_NESTED_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.bad_nested.run.stdout.log"
grep -Fq "file_open=0" "$BAD_NESTED_STDOUT"
grep -Fq "file_read_count=6" "$BAD_NESTED_STDOUT"

View File

@@ -1272,6 +1272,55 @@ verifyExpectedOutput(
);
for (const badFixture of [
{
name: "exists_1",
file: "exists-1.ngc",
readCount: 2,
executeCount: 1,
errorText: "Expected # reading parameter",
},
{
name: "exists_2",
file: "exists-2.ngc",
readCount: 2,
executeCount: 1,
errorText: "Expected ] reading bracketed parameter",
},
{
name: "exists_3",
file: "exists-3.ngc",
readCount: 3,
executeCount: 2,
errorText: "Parameter number out of range",
},
{
name: "exists_4",
file: "exists-4.ngc",
readCount: 2,
executeCount: 1,
errorText: "Unknown word starting with f",
},
{
name: "exists_5",
file: "exists-5.ngc",
readCount: 2,
executeCount: 1,
errorText: "Named parameter not terminated",
},
{
name: "exists_6",
file: "exists-6.ngc",
readCount: 2,
executeCount: 1,
errorText: "bad number format (conversion failed) parsing ''",
},
{
name: "exists_7",
file: "exists-7.ngc",
readCount: 2,
executeCount: 1,
errorText: "Expected ] reading bracketed parameter",
},
{
name: "nested",
file: "nested.ngc",