summaryrefslogtreecommitdiff
path: root/tests/tools.at
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-11-24 17:20:33 -0700
committerEric Blake <ebb9@byu.net>2009-12-04 21:18:07 -0700
commitb4f0a5079d7cc388094468deec96c1676af0e5f8 (patch)
tree824d67570b3273968ca19d1eb9bd47295a694087 /tests/tools.at
parent8edd55bbea8a59f7b0c4a31ae8403e4bb44bfc6b (diff)
downloadautoconf-b4f0a5079d7cc388094468deec96c1676af0e5f8.tar.gz
Warn if using unnamed diversion.
* lib/m4sugar/m4sugar.m4 (_m4_divert, m4_divert_push): Add optional parameter, which controls warning. (m4_divert_pop, m4_cleardivert, m4_divert_require) (_m4_require_call): Adjust callers. * lib/m4sugar/m4sh.m4 (AS_REQUIRE): Likewise. * tests/m4sh.at (AT_DATA_LINENO): Avoid triggering the warning. * tests/m4sugar.at (AT_CHECK_M4SUGAR_TEXT, m4@&t@_append) (m4@&t@_text_wrap, recursion): Likewise. (m4@&t@_warn, m4@&t@_divert_stack): Adjust expected output. * tests/tools.at (autom4te and whitespace in file names) (autoconf: the empty token): Avoid triggering the warning. (autoconf: AC_PRESERVE_HELP_ORDER): New test. * tests/mktests.sh (ac_exclude_list): Retire prior test. * NEWS: Document the warning. * doc/autoconf.texi (Redefined M4 Macros) <m4_divert>, <m4_undivert>: Make even more explicit that using these directly is discouraged. (Diversion support): Further warn against improper diversion changes. <m4_divert_text>: Give an example of proper use. Reported by Mike Frysinger. Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'tests/tools.at')
-rw-r--r--tests/tools.at43
1 files changed, 39 insertions, 4 deletions
diff --git a/tests/tools.at b/tests/tools.at
index e23ac04d..aa3f2585 100644
--- a/tests/tools.at
+++ b/tests/tools.at
@@ -164,7 +164,7 @@ do
cat >"$file" <<'END'
[m4@&t@_init[]m4@&t@_include(foo.m4)
-m4@&t@_divert(0)d@&t@nl
+m4@&t@_divert([])d@&t@nl
FOO]
END
cat >"$dir"/foo.m4 <<'END'
@@ -186,7 +186,7 @@ END
cat >"$file" <<'END'
[m4@&t@_init[]m4@&t@_include(foo.m4)
m4@&t@_pattern_forbid([^bar$])
-m4@&t@_divert(0)d@&t@nl
+m4@&t@_divert([])d@&t@nl
FOO]
END
rm -rf "$outfile" "$cachedir"
@@ -196,7 +196,7 @@ END
cat >"$file" <<'END'
[m4@&t@_init[]m4@&t@_include(foo.m4)
-m4@&t@_divert(0)d@&t@nl]
+m4@&t@_divert([])d@&t@nl]
END
rm -rf "$file.m4f"
AT_CHECK_AUTOM4TE([-C "$cachedir" -I "$dir" --language=m4sugar --freeze -o "$file.m4f" "$file"])
@@ -464,7 +464,7 @@ AT_SETUP([autoconf: the empty token])
AT_DATA_M4SH([configure.ac],
[[m4_init[]m4_pattern_allow([^foo$])
-m4_divert([0])dnl
+m4_divert([])dnl
line that begins with a space
]])
@@ -535,6 +535,41 @@ AT_CLEANUP
+# autoconf: AC_PRESERVE_HELP_ORDER
+# --------------------------------
+AT_SETUP([autoconf: AC_PRESERVE_HELP_ORDER])
+AT_KEYWORDS([m4@&t@_divert_text])
+
+AT_DATA_AUTOCONF([configure.ac],
+[[AC_INIT
+AC_PRESERVE_HELP_ORDER
+AC_ARG_WITH([one], [ --with-one])
+AC_ARG_ENABLE([two], [ --enable-two])
+m4_divert_text([HELP_ENABLE], [arbitrary $text])
+AC_ARG_WITH([three], [ --with-three])
+AC_OUTPUT
+]])
+
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE([--help], [], [stdout])
+AT_CHECK([sed -n '/^Optional/,/^$/p' stdout], [],
+[[Optional Features and Packages:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-one
+ --enable-two
+arbitrary $text
+ --with-three
+
+]])
+
+AT_CLEANUP
+
+
+
## --------- ##
## ifnames. ##
## --------- ##