Skip to content
Snippets Groups Projects
Commit 0dfd7438 authored by Sven M. Hallberg's avatar Sven M. Hallberg
Browse files

add regression test for gitlab issue 91

"assertion failure with ambiguous LALR compiles"
hammer/hammer#91
parent 756f814f
No related branches found
No related tags found
No related merge requests found
...@@ -366,6 +366,24 @@ static void test_ast_length_index() { ...@@ -366,6 +366,24 @@ static void test_ast_length_index() {
} }
#endif // 0 #endif // 0
static void test_issue91() {
// this ambiguous grammar caused intermittent (?) assertion failures when
// trying to compile with the LALR backend:
//
// assertion "action->type == HLR_SHIFT" failed: file "src/backends/lalr.c",
// line 34, function "follow_transition"
//
// cf. https://gitlab.special-circumstanc.es/hammer/hammer/issues/91
H_RULE(schar, h_ch_range(' ', '~')); /* overlaps digit */
H_RULE(digit, h_ch_range('0', '9'));
H_RULE(digits, h_choice(h_repeat_n(digit, 2), digit, NULL));
H_RULE(p, h_many(h_choice(schar, digits, NULL)));
int r = h_compile(p, PB_LALR, NULL);
g_check_cmp_int(r, ==, -2);
}
void register_regression_tests(void) { void register_regression_tests(void) {
g_test_add_func("/core/regression/bug118", test_bug118); g_test_add_func("/core/regression/bug118", test_bug118);
g_test_add_func("/core/regression/seq_index_path", test_seq_index_path); g_test_add_func("/core/regression/seq_index_path", test_seq_index_path);
...@@ -378,4 +396,5 @@ void register_regression_tests(void) { ...@@ -378,4 +396,5 @@ void register_regression_tests(void) {
g_test_add_func("/core/regression/bug19", test_bug_19); g_test_add_func("/core/regression/bug19", test_bug_19);
g_test_add_func("/core/regression/flatten_null", test_flatten_null); g_test_add_func("/core/regression/flatten_null", test_flatten_null);
//XXX g_test_add_func("/core/regression/ast_length_index", test_ast_length_index); //XXX g_test_add_func("/core/regression/ast_length_index", test_ast_length_index);
g_test_add_func("/core/regression/issue91", test_issue91);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment