summaryrefslogtreecommitdiff
path: root/tests/base.at
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2012-08-15 22:17:49 -0600
committerEric Blake <eblake@redhat.com>2012-08-15 22:23:04 -0600
commit1bb104167ed88a355a1c66e3e86cd49d9128cc4b (patch)
tree7bc490fa378ee43d09c27125d9d922dc2e8b71ab /tests/base.at
parent5fdd360bcbeeff0fdb3214aad1866c2f9eace98d (diff)
downloadautoconf-1bb104167ed88a355a1c66e3e86cd49d9128cc4b.tar.gz
AC_SUBST: document and test previous patch
Test that: invalid variable names are detected, that the variable name does not get macro expanded, that assignment to the variable works whether as part of AC_SUBST or independently, that the last assignment wins. * doc/autoconf.texi (Setting Output Variables) <AC_SUBST>: Mention that variable does not overlap with macros. * tests/base.at (AC_SUBST): New test. Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/base.at')
-rw-r--r--tests/base.at59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/base.at b/tests/base.at
index 79794133..d8550df7 100644
--- a/tests/base.at
+++ b/tests/base.at
@@ -708,3 +708,62 @@ libdir=${exec_prefix}/lib
]])
AT_CLEANUP
+
+## ---------- ##
+## AC_SUBST. ##
+## ---------- ##
+
+AT_SETUP([AC_SUBST])
+AT_KEYWORDS([AS@&t@_IDENTIFIER_IF])
+
+# Check that a valid variable name is used.
+AT_DATA([configure.ac],
+[[AC_INIT([test], [1])
+AC_SUBST([1], [bar])
+AC_OUTPUT
+]])
+AT_CHECK_AUTOCONF([], [1], [], [stderr])
+AT_CHECK([grep 'not a valid shell variable' stderr], [], [ignore])
+
+AT_DATA([configure.ac],
+[[AC_INIT([test], [1])
+AC_SUBST([], [bar])
+AC_OUTPUT
+]])
+AT_CHECK_AUTOCONF([], [1], [], [stderr])
+AT_CHECK([grep 'not a valid shell variable' stderr], [], [ignore])
+
+AT_DATA([configure.ac],
+[[AC_INIT([test], [1])
+AC_SUBST([*], [bar])
+AC_OUTPUT
+]])
+AT_CHECK_AUTOCONF([], [1], [], [stderr])
+AT_CHECK([grep 'not a valid shell variable' stderr], [], [ignore])
+
+# Make sure AC_SUBST handles variables as expected.
+AT_DATA([file.in],
+[[@FOO@
+@BAR@
+FOO
+]])
+AT_DATA([configure.ac],
+[[AC_INIT([test], [0])
+m4_define([FOO], [baz])
+AC_SUBST([FOO], [bar])
+BAR=one
+AC_SUBST([B@&t@AR])
+BAR=two
+AC_CONFIG_FILES([file])
+AC_OUTPUT
+]])
+
+AT_CHECK_AUTOCONF([], [], [], [stderr])
+AT_CHECK_CONFIGURE
+AT_CHECK([cat file], [],
+[[bar
+two
+FOO
+]])
+
+AT_CLEANUP