From: Akim Demaille Date: Mon, 10 Sep 2001 09:31:50 +0000 (+0000) Subject: * tests/calc.at: Use m4_match. X-Git-Tag: BISON-1_29a~21 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/3b14996787f7bbe27698216e090c863d072d6677?ds=inline * tests/calc.at: Use m4_match. (_AT_DATA_CALC_Y): Check `yyin != NULL', not `stdin != NULL'. --- diff --git a/ChangeLog b/ChangeLog index 51e6db5b..7b62864b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-09-10 Akim Demaille + + * tests/calc.at: Use m4_match. + (_AT_DATA_CALC_Y): Check `yyin != NULL', not `stdin != NULL'. + 2001-09-10 Marc Autret , Akim Demaille * src/vcg.h (graph_s): color, textcolor, bordercolor are now diff --git a/tests/calc.at b/tests/calc.at index 4107dcb0..d203e58c 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -220,14 +220,16 @@ power (int base, int exponent) } int -main (int argn, const char **argv) +main (int argc, const char **argv) { - if (argn == 2) + yyin = NULL; + + if (argc == 2) yyin = fopen (argv[1], "r"); else yyin = stdin; - if (!stdin) + if (!yyin) { perror (argv[1]); exit (1); @@ -252,9 +254,8 @@ main (int argn, const char **argv) # Produce `calc.y'. m4_define([AT_DATA_CALC_Y], [_AT_DATA_CALC_Y($[1], $[2], $[3], - [m4_if(m4_regexp([$1], [--yyerror-verbose]), - [-1], [], - [[#define YYERROR_VERBOSE]])])]) + [m4_match([$1], [--yyerror-verbose], + [[#define YYERROR_VERBOSE]])])]) @@ -268,12 +269,12 @@ m4_define([_AT_CHECK_CALC], [AT_DATA([[input]], [[$2 ]]) -m4_if(m4_regexp([$1], [--debug]), - [-1], - [AT_CHECK([./calc &1 >/dev/null | grep 'parse error' >&2], - [1], [], [])])]) +m4_match([$1], [--debug], + [AT_CHECK([calc ./input 2>&1 >/dev/null | grep 'parse error' >&2], + [1], [], [])], + [AT_CHECK([./calc &1 >/dev/null | grep 'parse error' >&2], 0, - [], -[m4_if(m4_regexp([$1], [--location]), - [-1], [], [$3: ])[]dnl + [], +[m4_match([$1], [--location], [$3: ])[]dnl parse error[]dnl -m4_if(m4_regexp([$1], [--yyerror-verbose]), - [-1], [], [$4])[]dnl +m4_match([$1], [--yyerror-verbose], [$4])[]dnl ])])