+2000-12-20 Akim Demaille <akim@epita.fr>
+
+ * tests/atgeneral.m4 (AT_CLEANUP_FILE_IFELSE): Fix the regexp: the
+ pattern ` state* ' was added many times for `*' was improperly
+ escaped.
+ (AT_INIT): Remove the data files before running the tests.
+ Define AT_data_files and output it.
+ (AT_SETUP): Don't.
+ (_m4_divert(TEST)): Remove, now useless.
+
2000-12-20 Akim Demaille <akim@epita.fr>
* aclang.m4: `dnl' the AC_LANG_PUSH and AC_LANG_POP.
# - TAIL
# tail of the core for;case, overall wrap up, generation of debugging
# scripts and statistics.
-#
-# - TEST
-# for each test group: proper code, to reinsert between cleanups;
-# undiverted into TESTS once at_data_files diverted.
m4_define([_m4_divert(DEFAULT)], 0)
m4_define([_m4_divert(OPTIONS)], 10)
m4_define([_m4_divert(TESTS)], 50)
m4_define([_m4_divert(TAIL)], 60)
-m4_define([_m4_divert(TEST)], 100)
-
m4_divert_push([TESTS])
m4_divert_push([KILL])
m4_define([AT_INIT],
[m4_define([AT_ordinal], 0)
m4_define([AT_banner_ordinal], 0)
+m4_define([AT_data_files], [stdout stderr ])
m4_divert_push([DEFAULT])dnl
#! /bin/sh
for at_test in $at_tests
do
at_status=0
+ rm -rf $at_data_files
case $at_test in
dnl Tests inserted here (TESTS).
m4_divert([TAIL])[]dnl
m4_wrap([m4_divert_text([DEFAULT],
[# List of the tests.
at_tests_all="AT_TESTS_ALL "])])dnl
+m4_wrap([m4_divert_text([SETUP],
+ [# List of the output files.
+at_data_files="AT_data_files "])])dnl
])# AT_INIT
m4_append([AT_TESTS_ALL], [ ]m4_defn([AT_ordinal]))
m4_divert_text([HELP],
[m4_format([ %3d: %-15s %s], AT_ordinal, AT_LINE, [$1])])
-m4_pushdef([AT_data_files], [stdout stderr ])
m4_divert_push([TESTS])dnl
AT_ordinal ) [#] AT_ordinal. AT_LINE: $1
-dnl Here will be inserted the definition of at_data_files.
-m4_divert([TEST])[]dnl
- rm -rf $at_data_files
echo AT_LINE >at-setup-line
$at_verbose 'testing $1'
$at_verbose $at_n " $at_c"
# AT_CLEANUP_FILE_IFELSE(FILE, IF-REGISTERED, IF-NOT-REGISTERED)
# --------------------------------------------------------------
+# We try to build a regular expression matching `[', `]', `*', and
+# `.', i.e., the regexp active characters.
+#
+# Novices would write, `[[]*.]', which sure fails since the character
+# class ends with the first closing braquet.
+# M4 gurus will sure write `[\[\]*.]', but it will fail too because
+# regexp does not support this and understands `\' per se.
+# Regexp gurus will write `[][*.]' which is indeed what Regexp expects,
+# but it will fail for M4 reasons: it's the same as `[*.]'.
+#
+# So the question is:
+#
+# Can you write a regexp that matches those four characters,
+# and respects the M4 quotation contraints?
+#
+# The answer is: (rot13) tvira va gur ertrkc orybj, lbh vqvbg!
m4_define([AT_CLEANUP_FILE_IFELSE],
-[m4_if(m4_regexp(AT_data_files, m4_patsubst([ $1 ], [\([\[\]*.]\)], [\\\1])),
+[m4_if(m4_regexp(AT_data_files, m4_patsubst([ $1 ], [[[]\|[]]\|[*.]], [\\\&])),
-1,
[$3], [$2])])
;;
m4_divert([TESTS])[]dnl
- at_data_files="AT_data_files"
-m4_undivert([TEST])[]dnl
-m4_popdef([AT_data_files])dnl
m4_divert_pop()dnl
])# AT_CLEANUP
# - TAIL
# tail of the core for;case, overall wrap up, generation of debugging
# scripts and statistics.
-#
-# - TEST
-# for each test group: proper code, to reinsert between cleanups;
-# undiverted into TESTS once at_data_files diverted.
m4_define([_m4_divert(DEFAULT)], 0)
m4_define([_m4_divert(OPTIONS)], 10)
m4_define([_m4_divert(TESTS)], 50)
m4_define([_m4_divert(TAIL)], 60)
-m4_define([_m4_divert(TEST)], 100)
-
m4_divert_push([TESTS])
m4_divert_push([KILL])
m4_define([AT_INIT],
[m4_define([AT_ordinal], 0)
m4_define([AT_banner_ordinal], 0)
+m4_define([AT_data_files], [stdout stderr ])
m4_divert_push([DEFAULT])dnl
#! /bin/sh
for at_test in $at_tests
do
at_status=0
+ rm -rf $at_data_files
case $at_test in
dnl Tests inserted here (TESTS).
m4_divert([TAIL])[]dnl
m4_wrap([m4_divert_text([DEFAULT],
[# List of the tests.
at_tests_all="AT_TESTS_ALL "])])dnl
+m4_wrap([m4_divert_text([SETUP],
+ [# List of the output files.
+at_data_files="AT_data_files "])])dnl
])# AT_INIT
m4_append([AT_TESTS_ALL], [ ]m4_defn([AT_ordinal]))
m4_divert_text([HELP],
[m4_format([ %3d: %-15s %s], AT_ordinal, AT_LINE, [$1])])
-m4_pushdef([AT_data_files], [stdout stderr ])
m4_divert_push([TESTS])dnl
AT_ordinal ) [#] AT_ordinal. AT_LINE: $1
-dnl Here will be inserted the definition of at_data_files.
-m4_divert([TEST])[]dnl
- rm -rf $at_data_files
echo AT_LINE >at-setup-line
$at_verbose 'testing $1'
$at_verbose $at_n " $at_c"
# AT_CLEANUP_FILE_IFELSE(FILE, IF-REGISTERED, IF-NOT-REGISTERED)
# --------------------------------------------------------------
+# We try to build a regular expression matching `[', `]', `*', and
+# `.', i.e., the regexp active characters.
+#
+# Novices would write, `[[]*.]', which sure fails since the character
+# class ends with the first closing braquet.
+# M4 gurus will sure write `[\[\]*.]', but it will fail too because
+# regexp does not support this and understands `\' per se.
+# Regexp gurus will write `[][*.]' which is indeed what Regexp expects,
+# but it will fail for M4 reasons: it's the same as `[*.]'.
+#
+# So the question is:
+#
+# Can you write a regexp that matches those four characters,
+# and respects the M4 quotation contraints?
+#
+# The answer is: (rot13) tvira va gur ertrkc orybj, lbh vqvbg!
m4_define([AT_CLEANUP_FILE_IFELSE],
-[m4_if(m4_regexp(AT_data_files, m4_patsubst([ $1 ], [\([\[\]*.]\)], [\\\1])),
+[m4_if(m4_regexp(AT_data_files, m4_patsubst([ $1 ], [[[]\|[]]\|[*.]], [\\\&])),
-1,
[$3], [$2])])
;;
m4_divert([TESTS])[]dnl
- at_data_files="AT_data_files"
-m4_undivert([TEST])[]dnl
-m4_popdef([AT_data_files])dnl
m4_divert_pop()dnl
])# AT_CLEANUP