X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/91ce0b3a66b75bb5b66f48a5a3cf59f3be08c0a8..d0d3313d10a28aa6fe77f158d61b84424aa9b3ce:/tests/input.at diff --git a/tests/input.at b/tests/input.at index 6d8d552c..836ff6d6 100644 --- a/tests/input.at +++ b/tests/input.at @@ -69,7 +69,7 @@ AT_CLEANUP # _AT_UNUSED_VALUES_DECLARATIONS() -# -------------------------------------------- +# -------------------------------- # Generate the token, type, and destructor # declarations for the unused values tests. @@ -442,6 +442,7 @@ char apostrophe = '\''; #include #include +#include %} /* %{ and %} can be here too. */ @@ -509,8 +510,7 @@ yylex (void) #output "; /* " */ static size_t toknum; - if (! (toknum < sizeof input)) - abort (); + assert (toknum < sizeof input); yylval = value_as_yystype (input[toknum]); return input[toknum++]; } @@ -1340,3 +1340,32 @@ input.y:2.1-7: warning: POSIX Yacc forbids dashes in symbol names: foo-bar AT_BISON_CHECK([[-Werror,no-all,yacc input.y]], [[1]], [[]], [[experr]]) AT_CLEANUP + + +## ------------------------------------------------------ ## +## %name-prefix and %define api.prefix are incompatible. ## +## ------------------------------------------------------ ## + +AT_SETUP([[%name-prefix and %define api.prefix are incompatible]]) + +# AT_TEST(DIRECTIVES, OPTIONS, ERROR-LOCATION) +# -------------------------------------------- +m4_pushdef([AT_TEST], +[AT_DATA([[input.y]], +[[$1 +%% +exp:; +]]) +AT_BISON_CHECK([[$2 input.y]], [[1]], [[]], +[[$3: '%name-prefix' and '%define api.prefix' cannot be used together +]]) +]) + +AT_TEST([%define api.prefix foo %name-prefix "bar"], [], [input.y:1.9-18]) +AT_TEST([], [-Dapi.prefix=foo -p bar], [:2]) +AT_TEST([%name-prefix "bar"], [-Dapi.prefix=foo], [:2]) +AT_TEST([%define api.prefix foo], [-p bar], [input.y:1.9-18]) + +m4_popdef([AT_TEST]) + +AT_CLEANUP