From b0f98b1016367bf4515ce3d0da5eaa99615d9293 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Fri, 15 Nov 2002 08:56:40 +0000 Subject: [PATCH] Always check the value returned by yyparse. * tests/calc.at (_AT_DATA_CALC_Y): Have `main' exit with the value returned by yyparse. (_AT_CHECK_CALC_ERROR): Take the expected exit value as argument. Adjust calls. * tests/glr-regr1.at (glr-regr1.y): Have `main' exit with the value returned by yyparse. --- ChangeLog | 11 +++++++++++ tests/calc.at | 37 +++++++++++++++++++------------------ tests/glr-regr1.at | 3 +-- 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 10e8a89..6b5bb82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2002-11-15 Akim Demaille + + Always check the value returned by yyparse. + + * tests/calc.at (_AT_DATA_CALC_Y): Have `main' exit with the value + returned by yyparse. + (_AT_CHECK_CALC_ERROR): Take the expected exit value as argument. + Adjust calls. + * tests/glr-regr1.at (glr-regr1.y): Have `main' exit with the value + returned by yyparse. + 2002-11-14 Paul Hilfinger * data/glr.c (yyFail): Always set yyerrflag. Corrects regression diff --git a/tests/calc.at b/tests/calc.at index b226cbc..f558e27 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -291,6 +291,7 @@ main (int argc, const char **argv) { value_t result = 0; int count = 0; + int status = 0; yyin = NULL; if (argc == 2) @@ -307,11 +308,10 @@ main (int argc, const char **argv) #if YYDEBUG yydebug = 1; #endif - yyparse (]AT_PARAM_IF([&result, &count])[); + status = yyparse (]AT_PARAM_IF([&result, &count])[); assert (global_result == result); assert (global_count == count); - - return 0; + return status; } ]]) ])# _AT_DATA_CALC_Y @@ -349,9 +349,10 @@ m4_bmatch([$1], ]) -# _AT_CHECK_CALC_ERROR(BISON-OPTIONS, INPUT, [NUM-DEBUG-LINES], +# _AT_CHECK_CALC_ERROR(BISON-OPTIONS, EXIT-STATUS, INPUT, +# [NUM-DEBUG-LINES], # [VERBOSE-AND-LOCATED-ERROR-MESSAGE]) -# ------------------------------------------------------------- +# --------------------------------------------------------- # Run `calc' on INPUT, and expect a `parse error' message. # # If INPUT starts with a slash, it is used as absolute input file name, @@ -367,17 +368,17 @@ m4_bmatch([$1], # If BISON-OPTIONS contains `%debug' but not `%glr', then NUM-STDERR-LINES # is the number of expected lines on stderr. m4_define([_AT_CHECK_CALC_ERROR], -[m4_bmatch([$2], [^/], - [AT_PARSER_CHECK([./calc $2], 0, [], [stderr])], +[m4_bmatch([$3], [^/], + [AT_PARSER_CHECK([./calc $3], $2, [], [stderr])], [AT_DATA([[input]], -[[$2 +[[$3 ]]) -AT_PARSER_CHECK([./calc input], 0, [], [stderr])]) +AT_PARSER_CHECK([./calc input], $2, [], [stderr])]) m4_bmatch([$1], [%debug.*%glr\|%glr.*%debug], [], [%debug], - [AT_CHECK([wc -l