Report prescan errors on their source lines
Some checks failed
akbasic CI Build / coverage (push) Failing after 27s
akbasic CI Build / cmake_build (push) Failing after 33s
akbasic CI Build / akgl_build (push) Failing after 18s
akbasic CI Build / sanitizers (push) Failing after 1m7s
akbasic CI Build / mutation_test (push) Failing after 39s
Some checks failed
akbasic CI Build / coverage (push) Failing after 27s
akbasic CI Build / cmake_build (push) Failing after 33s
akbasic CI Build / akgl_build (push) Failing after 18s
akbasic CI Build / sanitizers (push) Failing after 1m7s
akbasic CI Build / mutation_test (push) Failing after 39s
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user