/[bison]/bison/tests/calc.at
ViewVC logotype

Diff of /bison/tests/calc.at

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5.2.2 by akim, Mon Sep 10 09:31:50 2001 UTC revision 1.5.2.3 by akim, Tue Sep 18 10:51:36 2001 UTC
# Line 262  m4_define([AT_DATA_CALC_Y], Line 262  m4_define([AT_DATA_CALC_Y],
262  # _AT_CHECK_CALC(BISON-OPTIONS, INPUT)  # _AT_CHECK_CALC(BISON-OPTIONS, INPUT)
263  # ------------------------------------  # ------------------------------------
264  # Run `calc' on INPUT and expect no STDOUT nor STDERR.  # Run `calc' on INPUT and expect no STDOUT nor STDERR.
 # If `--debug' is passed to bison, discard all the debugging traces  
 # preserving only the `parse errors'.  Note that since there should be  
 # none, the `grep' will fail with exit status 1.  
265  m4_define([_AT_CHECK_CALC],  m4_define([_AT_CHECK_CALC],
266  [AT_DATA([[input]],  [AT_DATA([[input]],
267  [[$2  [[$2
268  ]])  ]])
269  m4_match([$1], [--debug],  AT_CHECK([calc input])dnl
           [AT_CHECK([calc ./input 2>&1 >/dev/null | grep 'parse error' >&2],  
                     [1], [], [])],  
           [AT_CHECK([./calc <input],  
                [0], [], [])])dnl  
270  ])  ])
271    
272    
273  # _AT_CHECK_CALC_ERROR(BISON-OPTIONS, INPUT,  # _AT_CHECK_CALC_ERROR(BISON-OPTIONS, INPUT,
274  #                      [ERROR-LOCATION], [IF-YYERROR-VERBOSE])  #                      [ERROR-LOCATION], [IF-YYERROR-VERBOSE])
275  # ------------------------------------------------------------  # ------------------------------------------------------------
276  # Run `calc' on INPUT, and expect STDERR.  # Run `calc' on INPUT, and expect a `parse error' message.
277    #
278    # If BISON-OPTIONS contains `--location', then make sure the ERROR-LOCATION
279    # is correctly output on stderr.
280    #
281    # If BISON-OPTIONS contains `--yyerror-verbose', then make sure the
282    # IF-YYERROR-VERBOSE message is properly output after `parse error, '
283    # on STDERR.
284  m4_define([_AT_CHECK_CALC_ERROR],  m4_define([_AT_CHECK_CALC_ERROR],
285  [AT_DATA([[input]],  [AT_DATA([[input]],
286  [[$2  [[$2
287  ]])  ]])
288    
289  AT_CHECK([./calc <input 2>&1 >/dev/null | grep 'parse error' >&2], 0,  AT_CHECK([calc input], 0,
290           [],           [],
291  [m4_match([$1], [--location], [$3: ])[]dnl  [m4_match([$1], [--location], [$3: ])[]dnl
292  parse error[]dnl  parse error[]dnl
293  m4_match([$1], [--yyerror-verbose], [$4])[]dnl  m4_match([$1], [--yyerror-verbose], [, $4])[]dnl
294    
295  ])])  ])])
296    
# Line 329  _AT_CHECK_CALC([$1], Line 329  _AT_CHECK_CALC([$1],
329  # Some parse errors.  # Some parse errors.
330  _AT_CHECK_CALC_ERROR([$1], [+1],  _AT_CHECK_CALC_ERROR([$1], [+1],
331                       [1.0:1.1],                       [1.0:1.1],
332                       [, unexpected `'+''])                       [unexpected `'+''])
333  _AT_CHECK_CALC_ERROR([$1], [1//2],  _AT_CHECK_CALC_ERROR([$1], [1//2],
334                       [1.2:1.3],                       [1.2:1.3],
335                       [, unexpected `'/'', expecting `NUM' or `'-'' or `'(''])                       [unexpected `'/'', expecting `NUM' or `'-'' or `'(''])
336  _AT_CHECK_CALC_ERROR([$1], [error],  _AT_CHECK_CALC_ERROR([$1], [error],
337                       [1.0:1.1],                       [1.0:1.1],
338                       [, unexpected `$undefined.'])                       [unexpected `$undefined.'])
339  _AT_CHECK_CALC_ERROR([$1], [1 = 2 = 3],  _AT_CHECK_CALC_ERROR([$1], [1 = 2 = 3],
340                       [1.6:1.7],                       [1.6:1.7],
341                       [, unexpected `'=''])                       [unexpected `'=''])
342  _AT_CHECK_CALC_ERROR([$1],  _AT_CHECK_CALC_ERROR([$1],
343                       [                       [
344  +1],  +1],
345                       [2.0:2.1],                       [2.0:2.1],
346                       [, unexpected `'+''])                       [unexpected `'+''])
347    
348  AT_CLEANUP(calc calc.c calc.h calc.output)  AT_CLEANUP(calc calc.c calc.h calc.output)
349  ])# AT_CHECK_CALC  ])# AT_CHECK_CALC

Legend:
Removed from v.1.5.2.2  
changed lines
  Added in v.1.5.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26