* tests/Makefile.am (package.m4): New.

* tests/calc.at (_AT_CHECK_CALC): Just run `calc input'.
(_AT_CHECK_CALC_ERROR): Likewise.
Factor the `, ' part of verbose error messages.
This commit is contained in:
Akim Demaille
2001-09-18 10:51:36 +00:00
parent 6f0d1fd89d
commit 3068221b53
4 changed files with 51 additions and 20 deletions

View File

@@ -1,5 +1,12 @@
2001-09-18 Akim Demaille <akim@epita.fr>
* tests/Makefile.am (package.m4): New.
* tests/calc.at (_AT_CHECK_CALC): Just run `calc input'.
(_AT_CHECK_CALC_ERROR): Likewise.
Factor the `, ' part of verbose error messages.
2001-09-18 Marc Autret <autret_m@epita.fr>
* src/getargs.c (longopts): Declare --defines and --graph as options
with optional arguments.
* src/files.h: Add extern declarations.
@@ -10,7 +17,7 @@
2001-09-18 Marc Autret <autret_m@epita.fr>
Turn off %{source,header}_extension feature.
* src/files.c (compute_exts_from_gf): Update.
(compute_exts_from_src): Update.
(output_files): CPP-out useless code.

View File

@@ -30,7 +30,7 @@ TESTSUITE = $(srcdir)/testsuite
AUTOM4TE = autom4te
AUTOTEST = $(AUTOM4TE) --language=autotest
$(srcdir)/$(TESTSUITE): $(TESTSUITE_AT)
$(srcdir)/$(TESTSUITE): package.m4 $(TESTSUITE_AT)
$(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp
mv $@.tmp $@
@@ -49,3 +49,17 @@ check-local: atconfig atlocal $(TESTSUITE)
# Run the test suite on the *installed* tree.
installcheck-local:
$(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin
## ------------ ##
## package.m4. ##
## ------------ ##
package.m4: $(top_srcdir)/configure.in
{ \
echo '# Signature of the current package.'; \
echo 'm4_define([PACKAGE_NAME], [@PACKAGE_NAME@])'; \
echo 'm4_define([PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \
echo 'm4_define([PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \
echo 'm4_define([PACKAGE_STRING], [@PACKAGE_STRING@])'; \
echo 'm4_define([PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
} >package.m4

View File

@@ -228,7 +228,7 @@ uninstall-am: uninstall-info-am
maintainer-clean-generic mostlyclean mostlyclean-generic \
uninstall uninstall-am uninstall-info-am
$(srcdir)/$(TESTSUITE): $(TESTSUITE_AT)
$(srcdir)/$(TESTSUITE): package.m4 $(TESTSUITE_AT)
$(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp
mv $@.tmp $@
@@ -247,6 +247,16 @@ check-local: atconfig atlocal $(TESTSUITE)
# Run the test suite on the *installed* tree.
installcheck-local:
$(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin
package.m4: $(top_srcdir)/configure.in
{ \
echo '# Signature of the current package.'; \
echo 'm4_define([PACKAGE_NAME], [@PACKAGE_NAME@])'; \
echo 'm4_define([PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \
echo 'm4_define([PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \
echo 'm4_define([PACKAGE_STRING], [@PACKAGE_STRING@])'; \
echo 'm4_define([PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
} >package.m4
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -262,35 +262,35 @@ m4_define([AT_DATA_CALC_Y],
# _AT_CHECK_CALC(BISON-OPTIONS, INPUT)
# ------------------------------------
# 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.
m4_define([_AT_CHECK_CALC],
[AT_DATA([[input]],
[[$2
]])
m4_match([$1], [--debug],
[AT_CHECK([calc ./input 2>&1 >/dev/null | grep 'parse error' >&2],
[1], [], [])],
[AT_CHECK([./calc <input],
[0], [], [])])dnl
AT_CHECK([calc input])dnl
])
# _AT_CHECK_CALC_ERROR(BISON-OPTIONS, INPUT,
# [ERROR-LOCATION], [IF-YYERROR-VERBOSE])
# ------------------------------------------------------------
# Run `calc' on INPUT, and expect STDERR.
# Run `calc' on INPUT, and expect a `parse error' message.
#
# If BISON-OPTIONS contains `--location', then make sure the ERROR-LOCATION
# is correctly output on stderr.
#
# If BISON-OPTIONS contains `--yyerror-verbose', then make sure the
# IF-YYERROR-VERBOSE message is properly output after `parse error, '
# on STDERR.
m4_define([_AT_CHECK_CALC_ERROR],
[AT_DATA([[input]],
[[$2
]])
AT_CHECK([./calc <input 2>&1 >/dev/null | grep 'parse error' >&2], 0,
AT_CHECK([calc input], 0,
[],
[m4_match([$1], [--location], [$3: ])[]dnl
parse error[]dnl
m4_match([$1], [--yyerror-verbose], [$4])[]dnl
m4_match([$1], [--yyerror-verbose], [, $4])[]dnl
])])
@@ -329,21 +329,21 @@ _AT_CHECK_CALC([$1],
# Some parse errors.
_AT_CHECK_CALC_ERROR([$1], [+1],
[1.0:1.1],
[, unexpected `'+''])
[unexpected `'+''])
_AT_CHECK_CALC_ERROR([$1], [1//2],
[1.2:1.3],
[, unexpected `'/'', expecting `NUM' or `'-'' or `'(''])
[unexpected `'/'', expecting `NUM' or `'-'' or `'(''])
_AT_CHECK_CALC_ERROR([$1], [error],
[1.0:1.1],
[, unexpected `$undefined.'])
[unexpected `$undefined.'])
_AT_CHECK_CALC_ERROR([$1], [1 = 2 = 3],
[1.6:1.7],
[, unexpected `'=''])
[unexpected `'=''])
_AT_CHECK_CALC_ERROR([$1],
[
+1],
[2.0:2.1],
[, unexpected `'+''])
[unexpected `'+''])
AT_CLEANUP(calc calc.c calc.h calc.output)
])# AT_CHECK_CALC