tests: improve factoring of the main function

* tests/local.at (AT_MAIN_DEFINE): If %debug is used, check if
-d/--debug is passed to the generated parser, and enable the traces.
Return exactly the result of yyparse, so that we can check exit code
2 too.
* tests/actions.at, tests/glr-regression.at, tests/regression.at:
Use AT_MAIN_DEFINE, helping AT_BISON_OPTION_PUSHDEFS where needed,
preferably to option -t.
This commit is contained in:
Akim Demaille
2013-01-21 15:38:49 +01:00
parent 3ef9fa8f83
commit f42c012fcf
4 changed files with 61 additions and 117 deletions

View File

@@ -1658,7 +1658,7 @@ AT_CLEANUP
AT_SETUP([Ambiguity reports])
AT_BISON_OPTION_PUSHDEFS
AT_BISON_OPTION_PUSHDEFS([%debug])
AT_DATA_GRAMMAR([input.y],
[[
%{
@@ -1681,12 +1681,7 @@ d: /* nada. */;
%%
]AT_YYLEX_DEFINE(["abc"])[
]AT_YYERROR_DEFINE[
int
main (void)
{
yydebug = 1;
return !!yyparse ();
}
]AT_MAIN_DEFINE[
]])
AT_BISON_OPTION_POPDEFS
@@ -1695,7 +1690,7 @@ AT_BISON_CHECK([[-o input.c input.y]], 0, [],
]])
AT_COMPILE([input])
AT_PARSER_CHECK([[./input]], 1, [],
AT_PARSER_CHECK([[./input --debug]], 1, [],
[Starting parse
Entering state 0
Reading a token: Next token is token 'a' ()