Parser: Fix not setting error when -> is missing in dictionaries
This commit is contained in:
parent
721d2d2d21
commit
7903686fe7
2 changed files with 15 additions and 1 deletions
|
|
@ -713,7 +713,7 @@ parse_dict(
|
|||
}
|
||||
|
||||
if (p->token.type != APFL_TOK_MAPSTO) {
|
||||
unread_token(p);
|
||||
p->error = ERR_UNEXPECTED_TOKEN(p->token);
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1212,6 +1212,18 @@ TEST(err_statements_before_params, t) {
|
|||
destroy_parser_test(pt);
|
||||
}
|
||||
|
||||
TEST(err_dict_mapsto_missing, t) {
|
||||
struct parser_test *pt = new_parser_test(t, "[foo -> bar, baz wtf -> xyu]");
|
||||
expect_error_of_type(pt, APFL_ERR_UNEXPECTED_TOKEN);
|
||||
destroy_parser_test(pt);
|
||||
}
|
||||
|
||||
TEST(err_dict_mapsto_too_early, t) {
|
||||
struct parser_test *pt = new_parser_test(t, "[foo -> bar -> baz]");
|
||||
expect_error_of_type(pt, APFL_ERR_UNEXPECTED_TOKEN);
|
||||
destroy_parser_test(pt);
|
||||
}
|
||||
|
||||
TESTS_BEGIN
|
||||
ADDTEST(empty),
|
||||
ADDTEST(hello_world),
|
||||
|
|
@ -1242,4 +1254,6 @@ TESTS_BEGIN
|
|||
ADDTEST(err_mapsto_in_list),
|
||||
ADDTEST(err_expr_in_param),
|
||||
ADDTEST(err_statements_before_params),
|
||||
ADDTEST(err_dict_mapsto_missing),
|
||||
ADDTEST(err_dict_mapsto_too_early),
|
||||
TESTS_END
|
||||
|
|
|
|||
Loading…
Reference in a new issue