353 |
# [NUM-DEBUG-LINES], |
# [NUM-DEBUG-LINES], |
354 |
# [VERBOSE-AND-LOCATED-ERROR-MESSAGE]) |
# [VERBOSE-AND-LOCATED-ERROR-MESSAGE]) |
355 |
# --------------------------------------------------------- |
# --------------------------------------------------------- |
356 |
# Run `calc' on INPUT, and expect a `parse error' message. |
# Run `calc' on INPUT, and expect a `syntax error' message. |
357 |
# |
# |
358 |
# If INPUT starts with a slash, it is used as absolute input file name, |
# If INPUT starts with a slash, it is used as absolute input file name, |
359 |
# otherwise as contents. |
# otherwise as contents. |
362 |
# is correctly output on stderr. |
# is correctly output on stderr. |
363 |
# |
# |
364 |
# If BISON-OPTIONS contains `%error-verbose', then make sure the |
# If BISON-OPTIONS contains `%error-verbose', then make sure the |
365 |
# IF-YYERROR-VERBOSE message is properly output after `parse error, ' |
# IF-YYERROR-VERBOSE message is properly output after `syntax error, ' |
366 |
# on STDERR. |
# on STDERR. |
367 |
# |
# |
368 |
# If BISON-OPTIONS contains `%debug' but not `%glr', then NUM-STDERR-LINES |
# If BISON-OPTIONS contains `%debug' but not `%glr', then NUM-STDERR-LINES |
406 |
mv at-expout expout]]) |
mv at-expout expout]]) |
407 |
# 4. If error-verbose is not used, strip the`, unexpected....' part. |
# 4. If error-verbose is not used, strip the`, unexpected....' part. |
408 |
m4_bmatch([$1], [%error-verbose], [], |
m4_bmatch([$1], [%error-verbose], [], |
409 |
[[sed 's/parse error, .*$/parse error/' expout >at-expout |
[[sed 's/syntax error, .*$/syntax error/' expout >at-expout |
410 |
mv at-expout expout]]) |
mv at-expout expout]]) |
411 |
# 5. Check |
# 5. Check |
412 |
AT_CHECK([cat stderr], 0, [expout]) |
AT_CHECK([cat stderr], 0, [expout]) |
497 |
(2^2)^3 = 64], |
(2^2)^3 = 64], |
498 |
[486]) |
[486]) |
499 |
|
|
500 |
# Some parse errors. |
# Some syntax errors. |
501 |
_AT_CHECK_CALC_ERROR([$1], [1], [0 0], [11], |
_AT_CHECK_CALC_ERROR([$1], [1], [0 0], [11], |
502 |
[1.3-1.4: parse error, unexpected "number"]) |
[1.3-1.4: syntax error, unexpected "number"]) |
503 |
_AT_CHECK_CALC_ERROR([$1], [1], [1//2], [15], |
_AT_CHECK_CALC_ERROR([$1], [1], [1//2], [15], |
504 |
[1.3-1.4: parse error, unexpected '/', expecting "number" or '-' or '(']) |
[1.3-1.4: syntax error, unexpected '/', expecting "number" or '-' or '(']) |
505 |
_AT_CHECK_CALC_ERROR([$1], [1], [error], [4], |
_AT_CHECK_CALC_ERROR([$1], [1], [error], [4], |
506 |
[1.1-1.2: parse error, unexpected $undefined, expecting "number" or '-' or '\n' or '(']) |
[1.1-1.2: syntax error, unexpected $undefined, expecting "number" or '-' or '\n' or '(']) |
507 |
_AT_CHECK_CALC_ERROR([$1], [1], [1 = 2 = 3], [22], |
_AT_CHECK_CALC_ERROR([$1], [1], [1 = 2 = 3], [22], |
508 |
[1.7-1.8: parse error, unexpected '=']) |
[1.7-1.8: syntax error, unexpected '=']) |
509 |
_AT_CHECK_CALC_ERROR([$1], [1], |
_AT_CHECK_CALC_ERROR([$1], [1], |
510 |
[ |
[ |
511 |
+1], |
+1], |
512 |
[14], |
[14], |
513 |
[2.1-2.2: parse error, unexpected '+']) |
[2.1-2.2: syntax error, unexpected '+']) |
514 |
# Exercise error messages with EOF: work on an empty file. |
# Exercise error messages with EOF: work on an empty file. |
515 |
_AT_CHECK_CALC_ERROR([$1], [1], [/dev/null], [4], |
_AT_CHECK_CALC_ERROR([$1], [1], [/dev/null], [4], |
516 |
[1.1-1.2: parse error, unexpected "end of input", expecting "number" or '-' or '\n' or '(']) |
[1.1-1.2: syntax error, unexpected "end of input", expecting "number" or '-' or '\n' or '(']) |
517 |
|
|
518 |
# Exercise the error token: without it, we die at the first error, |
# Exercise the error token: without it, we die at the first error, |
519 |
# hence be sure i. to have several errors, ii. to test the action |
# hence be sure i. to have several errors, ii. to test the action |
520 |
# associated to `error'. |
# associated to `error'. |
521 |
_AT_CHECK_CALC_ERROR([$1], [0], [(1 ++ 2) + (0 0) = 1], [82], |
_AT_CHECK_CALC_ERROR([$1], [0], [(1 ++ 2) + (0 0) = 1], [82], |
522 |
[1.5-1.6: parse error, unexpected '+', expecting "number" or '-' or '(' |
[1.5-1.6: syntax error, unexpected '+', expecting "number" or '-' or '(' |
523 |
1.15-1.16: parse error, unexpected "number" |
1.15-1.16: syntax error, unexpected "number" |
524 |
calc: error: 0 != 1]) |
calc: error: 0 != 1]) |
525 |
|
|
526 |
AT_CHECK_POPDEFS |
AT_CHECK_POPDEFS |