]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Handle special characters in test case titles correctly.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 27 Oct 2006 23:05:33 +0000 (23:05 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 27 Oct 2006 23:05:33 +0000 (23:05 +0000)
* 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.

ChangeLog
lib/autotest/general.m4
tests/autotest.at
tests/torture.at

index 959ca7f983c8c9efbb8a0d20d7f88dc88088db11..fe3c4d5b1d48716f68f8d0e1c10adbc938a7b000 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+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
index 6ce6dfa214a9161cd2756e1e8d292cb3f569ab36..9510d484e728de70831b96e10158de31ef7bddf7 100644 (file)
@@ -279,7 +279,7 @@ at_groups_all='AT_groups_all'
 # 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=
@@ -1176,9 +1176,9 @@ m4_append([AT_groups_all], [ ]m4_defn([AT_ordinal]))
 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
 ])
 
index 0bdb7a4365084be7d5cfa40676365d5c46747541..0ffe972a9cba29cd8c36a1faca8cf5aa6cb09bf4 100644 (file)
@@ -236,27 +236,62 @@ conf
 ## 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],
+                                                                  [\\], [:])
 
 
 ## ----------------- ##
index 436842f6c8ea76a258108d6063d1ef05d2d0499a..4990c9b526e891bf713ef81fd16249da88a64a05 100644 (file)
@@ -319,7 +319,7 @@ AT_CLEANUP
 # Use various forms of `#define' templates, and make sure there are no
 # problems when a symbol is prefix of another.
 
-AT_SETUP([#define header templates])
+AT_SETUP([[#define header templates]])
 
 AT_DATA([configure.ac],
 [[AC_INIT