opensubscriber
   Find in this group all groups
 
Unknown more information…

a : autoconf-patches@gnu.org 26 August 2010 • 7:18AM -0400

[PATCH 3/5] tests: improve some shell assumption testing
by Eric Blake

REPLY TO AUTHOR
 
REPLY TO GROUP




* tests/m4sh.at (Functions Support, Functions and return Support)
(Negated classes in globbing): Update comments.
(AS@&t@_VAR basics): Test comparison to empty string.
---

General cleanups, to ensure later patches don't break anything,
and to add coverage for an otherwise untested code path in 5/5.

ChangeLog     |    7 +++++++
tests/m4sh.at |   25 +++++++++++++++++++------
2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 88fcd88..0cefc7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2010-08-25  Eric Blake  <eblake@redh...>

+ tests: improve some shell assumption testing
+ * tests/m4sh.at (Functions Support, Functions and return Support)
+ (Negated classes in globbing): Update comments.
+ (AS@&t@_VAR basics): Test comparison to empty string.
+
+2010-08-25  Eric Blake  <eblake@redh...>
+
docs: mention cost of globbing during variable expansion
* doc/autoconf.texi (Shell Substitutions) <${var=literal}>:
Recommend quoting substitutions that might trigger globbing.
diff --git a/tests/m4sh.at b/tests/m4sh.at
index 52ab4ee..de2bdc9 100644
--- a/tests/m4sh.at
+++ b/tests/m4sh.at
@@ -528,8 +528,8 @@ AT_CLEANUP
## Negated classes in globbing.  ##
## ----------------------------- ##

-# It is known that `[^...]' is not universally supported, but it is
-# unknown for `[!...]'.
+# According to http://www.in-ulm.de/~mascheck/bourne/, all shells with
+# functions also support `[!...]'.  But `[^...]' is not universally supported.

AT_SETUP([Negated classes in globbing])
AT_KEYWORDS([m4sh])
@@ -559,8 +559,7 @@ AT_CLEANUP
## Functions Support.  ##
## ------------------- ##

-# Hypothesis: the shell we are running, after having checked for
-# $LINENO support, supports functions.
+# All m4sh scripts require function support.

AT_SETUP([Functions Support])
AT_KEYWORDS([m4sh])
@@ -602,8 +601,7 @@ AT_CLEANUP
## Functions and return Support.  ##
## ------------------------------ ##

-# Hypothesis: the shell we are running, after having checked for
-# $LINENO support, supports functions, and the `return' keyword.
+# All m4sh scripts require working return within functions.

AT_SETUP([Functions and return Support])
AT_KEYWORDS([m4sh])
@@ -1275,6 +1273,9 @@ AS_INIT
# Literals.
dnl AS_VAR_SET_IF also covers AS_VAR_TEST_SET
AS_VAR_SET_IF([foo], [echo oops]) && echo ok
+AS_VAR_IF([foo], [], [echo ok], [echo oops])
+foo=
+AS_VAR_SET_IF([foo], [echo ok])
AS_VAR_SET([foo], ['\a  "weird" `value` with; $fun '\''characters
']) # 'font-lock
AS_VAR_COPY([bar], [foo])
@@ -1292,6 +1293,9 @@ m4_ifdef([tmp], [echo oops])
echo '===='
num=1
AS_VAR_SET_IF([foo$num], [echo oops]) && echo ok
+AS_VAR_IF([foo$num], [], [echo ok], [echo oops])
+foo1=
+AS_VAR_SET_IF([foo$num], [echo ok])
AS_VAR_SET([foo$num], ['\a  "weird" `value` with; $fun '\''characters
']) # 'font-lock
AS_VAR_COPY([bar], [foo$num])
@@ -1310,6 +1314,9 @@ m4_ifdef([tmp], [echo oops])
# Indirects via command substitution.
echo '===='
AS_VAR_SET_IF([`echo foo3`], [echo oops]) && echo ok
+AS_VAR_IF([`echo foo3`], [], [echo ok], [echo oops])
+foo3=
+AS_VAR_SET_IF([`echo foo3`], [echo ok])
AS_VAR_SET([`echo foo3`], ['\a  "weird" `value` with; $fun '\''characters
']) # 'font-lock
AS_VAR_COPY([bar], [`echo foo3`])
@@ -1329,6 +1336,8 @@ m4_ifdef([tmp], [echo oops])

AT_CHECK_M4SH
AT_CHECK([$CONFIG_SHELL ./script], [], [[ok
+ok
+ok
\a  "weird" `value` WITH; $fun 'characters
-
\a  "weird" `value` WITH; $fun 'characters
@@ -1338,6 +1347,8 @@ ok
ok
====
ok
+ok
+ok
\a  "weird" `value` WITH; $fun 'characters
-
\a  "weird" `value` WITH; $fun 'characters-
@@ -1346,6 +1357,8 @@ ok
ok
====
ok
+ok
+ok
\a  "weird" `value` WITH; $fun 'characters
-
\a  "weird" `value` WITH; $fun 'characters-
--
1.7.2.2



Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.