+2006-10-26 Joel E. Denny <jdenny@ces.clemson.edu>
+ and Stepan Kasal <kasal@ucw.cz>
+
+ Handle special characters in test case titles correctly.
+ * lib/autotest/general.m4 (AT_INIT): M4-quote and AS_ESCAPE AT_help_all
+ properly.
+ (AT_SETUP): M4-quote and AS_ESCAPE the title properly everywhere.
+ * tests/autotest.at (AT_CHECK_AT_TITLE): Add EXPANDED-TITLE-TO-TEST
+ argument. Extend to check titles printed by ./micro-suite and
+ ./micro-suite -l and the title in micro-suite.log.
+ (Backquote in a test title,
+ Single-quote in a test title,
+ Double-quote in a test title): Don't expect failure anymore.
+ (Backslash in a test title): Put a non-whitespace character after the
+ backslash so that Bourne shells might actually see it as an escape
+ sequence.
+ (Brackets in a test title,
+ Pound in a test title,
+ Comma in a test title,
+ Quoted Macro in a test title,
+ Macro in a test title,
+ Macro with single-quote in a test title): New tests.
+ (Macro with backquote in a test title,
+ Macro with double-quote in a test title,
+ Macro with backslash in a test title): New tests expected to fail.
+ * tests/torture.at (#define header templates): M4-quote this title in
+ AT_SETUP call so that no M4 code is commented inadvertently somewhere.
+ The visible effect was a stray [] in the testsuite output.
+
2006-10-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* doc/autoconf.texi (Limitations of Builtins): Do not invoke
# numerical order.
at_format='m4_bpatsubst(m4_defn([AT_ordinal]), [.], [?])'
# Description of all the test groups.
-at_help_all='AT_help_all'])])dnl
+at_help_all="AS_ESCAPE(m4_defn([AT_help_all]))"])])dnl
m4_divert_push([PARSE_ARGS])dnl
at_prev=
m4_divert_push([TESTS])dnl
AT_ordinal ) @%:@ AT_ordinal. m4_defn([AT_line]): $1
at_setup_line='m4_defn([AT_line])'
- at_desc='$1'
+ at_desc="AS_ESCAPE([$1])"
$at_quiet $ECHO_N "m4_format([%3d: %-]m4_eval(47 - m4_qdelta([$1]))[s],
- AT_ordinal, [[$1]])[]$ECHO_C"
+ AT_ordinal, AS_ESCAPE([[$1]]))[]$ECHO_C"
m4_divert_push([TEST_SCRIPT])dnl
])
## Funny characters in test names. ##
## ------------------------------- ##
-# AT_CHECK_AT_TITLE(TITLE, TITLE-TO-TEST, [XFAIL-CONDITION])
-# ----------------------------------------------------------
+# AT_CHECK_AT_TITLE(TITLE, TITLE-TO-TEST, EXPANDED-TITLE-TO-TEST
+# [XFAIL-CONDITION])
+# ---------------------------------------------------------------
# Create a new test named TITLE that runs an Autotest test suite
-# comprised of a trivial test named TITLE-TO-TEST. XFAIL-CONDITION
-# passes verbatim to AT_CHECK_AT.
+# comprised of a trivial test named TITLE-TO-TEST, which expands
+# to EXPANDED-TITLE-TO-TEST. XFAIL-CONDITION passes verbatim to
+# AT_CHECK_AT.
m4_define([AT_CHECK_AT_TITLE],
[AT_CHECK_AT([$1],
[[
+m4@&t@_define([macro_name], [[macro_expanded]])
+m4@&t@_define([macro_expanded], [[macro_overexpanded]])
+m4@&t@_define([macro_backquote], [`])
+m4@&t@_define([macro_single_quote], ['])
+m4@&t@_define([macro_double_quote], ["])
+m4@&t@_define([macro_backslash], [\\])
AT_INIT([artificial test suite])
AT_SETUP([$2])
AT_CHECK([:])
AT_CLEANUP
-]], [$3])])
+]], [$4], [], [], [],
+[AT_CHECK([[./micro-suite | sed -n "s/[^:]*: \(.*[^ \t]\)[ \t]*ok.*/\1/p"]],,
+[[$3
+]])
+AT_CHECK([[./micro-suite -l \
+ | sed -n "s/.*[0-9]\+: [^ \t]\+[ \t]\+\(.*[^ \t]\)[ \t]*/\1/p"]],,
+[[$3
+]])
+AT_CHECK([[sed -n "s/[^.]*\. \(.*\) ([^)]*): ok.*/\1/p" micro-suite.log]],,
+[[$3
+]])
+])])
m4_define([AT_CHECK_AT_TITLE_CHAR],
-[AT_CHECK_AT_TITLE([$1 in a test title], [A $2 in my name], $3)])
-
-AT_CHECK_AT_TITLE_CHAR([Backquote], [`], [:])
-AT_CHECK_AT_TITLE_CHAR([Single-quote], ['], [:])
-AT_CHECK_AT_TITLE_CHAR([Double-quote], ["], [:])
-AT_CHECK_AT_TITLE_CHAR([Backslash], [\])
+[AT_CHECK_AT_TITLE([$1 in a test title], [A $2 in my name],
+ [A ]m4_ifval([$3], [[$3]], [[$2]])[ in my name], $4)])
+
+AT_CHECK_AT_TITLE_CHAR([Backquote], [`])
+AT_CHECK_AT_TITLE_CHAR([Single-quote], ['])
+AT_CHECK_AT_TITLE_CHAR([Double-quote], ["])
+AT_CHECK_AT_TITLE_CHAR([Backslash], [\\])
+AT_CHECK_AT_TITLE_CHAR([Brackets], [[[]]], [[]])
+AT_CHECK_AT_TITLE_CHAR([Pound], [[#]], [#])
+AT_CHECK_AT_TITLE_CHAR([Comma], [,])
+
+AT_CHECK_AT_TITLE_CHAR([Quoted Macro], [[macro_name]],
+ [macro_name])
+AT_CHECK_AT_TITLE_CHAR([Macro], [macro_name],
+ [macro_expanded])
+AT_CHECK_AT_TITLE_CHAR([Macro with backquote], [macro_backquote],
+ [`], [:])
+AT_CHECK_AT_TITLE_CHAR([Macro with single-quote], [macro_single_quote], ['])
+AT_CHECK_AT_TITLE_CHAR([Macro with double-quote], [macro_double_quote],
+ ["], [:])
+AT_CHECK_AT_TITLE_CHAR([Macro with backslash], [macro_backslash],
+ [\\], [:])
## ----------------- ##