Report prescan errors on their source lines
All checks were successful
akbasic CI Build / cmake_build (push) Successful in 3m28s
akbasic CI Build / sanitizers (push) Successful in 4m47s
akbasic CI Build / coverage (push) Successful in 3m58s
akbasic CI Build / akgl_build (push) Successful in 8m50s
akbasic CI Build / mutation_test (push) Successful in 23m38s

This commit is contained in:
2026-08-05 06:40:14 -04:00
committed by Starfort Source Vault
parent ed6f463897
commit 1f3b9f5cf6
8 changed files with 98 additions and 4 deletions

View File

@@ -218,6 +218,22 @@ static void test_declaration_errors_are_basic_errors(void)
}
}
/** @brief A field declaration error reports the field's source line. */
static void test_type_prescan_error_line(void)
{
TEST_REQUIRE_OK(harness_start(NULL));
TEST_REQUIRE_OK(akbasic_runtime_load(&HARNESS_RUNTIME,
"10 TYPE RECT\n"
"20 W# EXTRA\n"
"30 END TYPE\n"
"40 PRINT 1\n"));
TEST_REQUIRE_OK(akbasic_runtime_start(&HARNESS_RUNTIME, AKBASIC_MODE_RUN));
TEST_REQUIRE(strstr(HARNESS_OUTPUT, "? 20 : PARSE ERROR") != NULL,
"TYPE prescan should report its source line, got \"%s\"",
HARNESS_OUTPUT);
harness_stop();
}
/**
* @brief An over-long type or field name is refused, not silently trimmed.
*
@@ -270,6 +286,7 @@ int main(void)
test_missing_field_lists_the_others();
test_self_by_value_refused();
test_declaration_errors_are_basic_errors();
test_type_prescan_error_line();
test_long_names_are_refused();
return akbasic_test_failures;