2007-10-03 Eric Blake <ebb9@byu.net>
+ Remove some XFAILs, and make AT_SETUP output line up.
+ * lib/autotest/general.m4 (AT_SETUP): Only expand description
+ once; thereafter, use its expansion, properly quoted.
+ * tests/autotest.at (AT_CHECK_AT_TITLE): Also check macro
+ expansion with arguments, and check for aligned output.
+ (AT_CHECK_AT_TITLE_CHAR): Remove XFAILs for tests that now pass.
+ Add a test for macros with parameters.
+ * NEWS: Document the semantics change.
+ * tests/base.at: Fix test titles containing commas.
+ * tests/compile.at: Likewise.
+ * tests/tools.at: Likewise.
+ * tests/torture.at: Likewise.
+
Another round of regex avoidance.
* lib/m4sugar/m4sugar.m4 (m4_cr_alnum, m4_cr_all)
(_m4_define_cr_not, m4_cr_not_letters, m4_cr_not_LETTERS)
** The command 'autoconf -' now correctly processes a file from stdin.
+** AT_SETUP now handles macro expansions properly when calculating line
+ length. However, as a side effect, any whitespace immediately
+ following a single-quoted comma is lost. If you previously used
+ AT_SETUP([a, b]), you could change to AT_SETUP([a,[] b]) to keep
+ the space.
+
** Autotest now determines $srcdir correctly.
** Autoconf now requires GNU M4 1.4.5 or later. Earlier versions of M4 have
m4_ifdef([AT_capture_files], [m4_undefine([AT_capture_files])])
m4_define([AT_line], AT_LINE)
m4_define([AT_xfail], [at_xfail=no])
-m4_define([AT_description], [$1])
+m4_define([AT_description], m4_quote($1))
m4_define([AT_ordinal], m4_incr(AT_ordinal))
m4_append([AT_groups_all], [ ]m4_defn([AT_ordinal]))
m4_divert_push([TESTS])dnl
- AT_ordinal ) @%:@ AT_ordinal. m4_defn([AT_line]): $1
+ AT_ordinal ) @%:@ AT_ordinal. m4_defn([AT_line]): m4_defn([AT_description])
at_setup_line='m4_defn([AT_line])'
- at_desc="AS_ESCAPE([$1])"
- $at_quiet AS_ECHO_N(["m4_format([%3d: %-]m4_eval(47 - m4_qdelta([$1]))[s],
- AT_ordinal, AS_ESCAPE([[$1]]))[]"])
+ at_desc="AS_ESCAPE(m4_defn([AT_description]))"
+ $at_quiet AS_ECHO_N(["m4_format([%3d: ], AT_ordinal)$at_desc"]dnl
+["m4_format(%m4_eval(47 - m4_qlen(m4_defn([AT_description])))[s])"])
m4_divert_push([TEST_SCRIPT])dnl
])
[AT_CHECK_AT([$1],
[[
m4@&t@_define([macro_name], [[macro_expanded]])
-m4@&t@_define([macro_expanded], [[macro_overexpanded]])
+m4@&t@_define([macro_expanded], [[macro_overexpanded]])
m4@&t@_define([macro_backquote], [`])
m4@&t@_define([macro_single_quote], ['])
m4@&t@_define([macro_double_quote], ["])
]]dnl restore font-lock: "
-[[m4@&t@_define([macro_backslash], [\\])
+[[m4@&t@_define([macro_backslash], [\])
+m4@&t@_define([macro_echo], [$][1])
AT_INIT([artificial test suite])
AT_SETUP([$2])
AT_CHECK([:])
AT_CLEANUP
]], [$4], [], [], [],
+dnl This sed script checks for two things - that the output is properly
+dnl expanded, and that the 'ok' starts on column 53.
[AT_CHECK([[$CONFIG_SHELL ./micro-suite |
- sed -n 's/[^:]*: \(.*[^ ]\)[ ]*ok.*/\1/p']],,
+ sed -n '/^ 1:/{
+h
+s/[^:]*: \(.*[^ ]\)[ ]*ok.*/\1/p
+x
+s/^.\{53\}ok.*/ok/p
+}']],,
[[$3
+ok
]])
AT_CHECK([[$CONFIG_SHELL ./micro-suite -l |
sed -n 's/.*[0-9]: [^ ][^ ]*[ ][ ]*\(.*[^ ]\)[ ]*/\1/p']],,
[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([Backquote], [`])
+AT_CHECK_AT_TITLE_CHAR([Single-quote], ['])
+AT_CHECK_AT_TITLE_CHAR([Double-quote], ["])
dnl restore font-lock: "
-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([Backslash], [\])
+AT_CHECK_AT_TITLE_CHAR([Brackets], [[[]]], [[]])
+AT_CHECK_AT_TITLE_CHAR([Pound], [[#]], [#])
+AT_CHECK_AT_TITLE_CHAR([Quoted comma],[[,]], [,])
+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 double-quote], [macro_double_quote], ["])
dnl restore font-lock: "
-# This test neither fails nor passes reliably.
-# AT_CHECK_AT_TITLE_CHAR([Macro with backslash], [macro_backslash],
-# [\\], [:])
+AT_CHECK_AT_TITLE_CHAR([Macro with backslash], [macro_backslash], [\])
+AT_CHECK_AT_TITLE_CHAR([Macro echoing macro], [macro_echo([macro_name])],
+ [macro_expanded])
+AT_CHECK_AT_TITLE_CHAR([Macro echoing single-quote], [macro_echo(['])], ['])
## ----------------- ##
## AC_REQUIRE and AC_DEFUN_ONCE: Require, expand. ##
## ----------------------------------------------- ##
-AT_SETUP([AC_REQUIRE & AC_DEFUN_ONCE: Require, expand])
+AT_SETUP([AC_REQUIRE & AC_DEFUN_ONCE: [Require, expand]])
AT_DATA([configure.ac],
[[AC_DEFUN([TEST],
## AC_REQUIRE and AC_DEFUN_ONCE: Expand, require. ##
## ----------------------------------------------- ##
-AT_SETUP([AC_REQUIRE & AC_DEFUN_ONCE: Expand, require])
+AT_SETUP([AC_REQUIRE & AC_DEFUN_ONCE: [Expand, require]])
AT_DATA([configure.ac],
[[AC_DEFUN([TEST],
AT_BANNER([Low level compiling/preprocessing macros.])
-# Copyright (C) 2000, 2001, 2003, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2003, 2005, 2006, 2007 Free Software
+# Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
## AC_LANG, AC_LANG_PUSH & AC_LANG_POP. ##
## ------------------------------------- ##
-AT_SETUP([AC_LANG, AC_LANG_PUSH & AC_LANG_POP])
+AT_SETUP([[AC_LANG, AC_LANG_PUSH & AC_LANG_POP]])
AT_DATA([configure.ac],
[[AC_INIT
# autoconf: forbidden tokens, basic
# ---------------------------------
-AT_SETUP([autoconf: forbidden tokens, basic])
+AT_SETUP([autoconf: forbidden tokens,[] basic])
AT_DATA_M4SH([configure.ac],
[[AS_INIT
# autoconf: forbidden tokens, exceptions
# --------------------------------------
-AT_SETUP([autoconf: forbidden tokens, exceptions])
+AT_SETUP([autoconf: forbidden tokens,[] exceptions])
AT_DATA_M4SH([configure.ac],
[[AS_INIT
# Change a precious variable that contains all kinds of fun
AT_CHECK_AC_ARG_VAR(['p r ec"iou$], [orange of my eye])
+dnl restore font-lock: "
AT_CLEANUP
## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS. ##
## ---------------------------------------------- ##
-AT_SETUP([AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS])
+AT_SETUP([[AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS]])
AT_DATA([configure.ac],
[[AC_INIT
AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
["'$ " ' $ "'$
])
+dnl restore font-lock: "
AT_CLEANUP