5 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
6 # 2009, 2010 Free Software Foundation, Inc.
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ## ---------------- ##
23 ## ---------------- ##
28 # We cannot unset LINENO with Zsh, yet this test case relies on
29 # unsetting LINENO to compare its result when (i) LINENO is supported
30 # and when (ii) it is not.
31 # So just skip if the shell is ZSH.
32 AT_CHECK([test -n "${ZSH_VERSION+set}" && exit 77], ignore)
34 # AT_DATA_LINENO(FILE-NAME,
35 # UNSET-LINENO = true | false, COUNTER, COUNTER-RE)
36 # ----------------------------------------------------------------
37 # Produce the FILE-NAME M4sh script which uses the COUNTER LINENO or
38 # _oline_, which we can recognized via COUNTER-RE. Unset LINENO is
41 # Use COUNTER, COUNTER-RE = [__LINENO__], [LINENO]
42 # or = [__OLINE__], [_oline__]
44 # instead of the obvious $LINENO and __oline__, because they would
45 # be replaced in the test suite itself, even before creating these
46 # scripts. For the same reason, grep for LINENO and _oline__ (sic).
48 # UNSET-LINENO is a shell condition to make sure the scripts have the
49 # same number of lines in the output, so that their outputs be identical.
50 m4_define([AT_DATA_LINENO],
53 m4@&t@_divert_text([], [
55 AS@&t@_UNSET([LINENO])
60 grep 'Line: .*$4' "$[0]" >/dev/null ||
61 AS@&t@_ERROR([cannot find original script])
64 # If occurrences of $LINENO or __@&t@oline__ were wanted, create them.
65 sed 's/__LINENO__/$''LINENO/g;s/__OLINE__/__''oline__/g' $1.tas >$1.as
66 AT_CHECK([autom4te -l m4sh $1.as -o $1])
69 # `_oline_', once processed and ran, produces our reference.
70 # We check that we find ourselves by looking at a string which is
71 # available only in the original script: `_oline_'.
72 AT_DATA_LINENO([reference], [false], [__OLINE__], [_oline__])
73 AT_CHECK([./reference], 0, [stdout])
78 # Now using a maybe-functioning LINENO, with different call conventions.
79 # Be sure to be out of the PATH.
80 AT_CHECK([mkdir test || exit 77])
82 AT_DATA_LINENO([test/test-1], [false], [__LINENO__], [LINENO])
83 AT_CHECK([./test/test-1], 0, [expout])
84 AT_CHECK([(PATH=test$PATH_SEPARATOR$PATH; export PATH; exec test-1)],
86 AT_CHECK([sh ./test/test-1], 0, [expout])
88 # Now using a disabled LINENO, with different call conventions.
89 AT_DATA_LINENO([test/test-2], [true], [__LINENO__], [LINENO])
90 AT_CHECK([./test/test-2], 0, [expout])
91 AT_CHECK([(PATH=test$PATH_SEPARATOR$PATH; export PATH; exec test-2)],
93 AT_CHECK([sh ./test/test-2], 0, [expout])
99 ## ---------------------- ##
100 ## LINENO stack support. ##
101 ## ---------------------- ##
103 AT_SETUP([LINENO stack])
106 AT_DATA_M4SH([script.as],
109 AS_LINENO_PUSH([9999])
110 test $as_lineno = 9999 || AS_ERROR([bad as_lineno at depth 1])
111 AS_LINENO_PUSH([8888])
112 test $as_lineno = 9999 || AS_ERROR([bad as_lineno at depth 2])
114 test $as_lineno = 9999 || AS_ERROR([bad as_lineno at depth 1])
116 test x${as_lineno+set} = xset && AS_ERROR([as_lineno set at depth 0])
122 AT_CHECK([$CONFIG_SHELL ./script])
131 # Output a framed one-line message.
132 AT_SETUP([AS@&t@_BOX])
135 AT_DATA_M4SH([script.as],
138 AS_BOX([Send a simple message, to foobar@example.com])
139 AS_BOX([Send a simple message, to foobar@example.com], [$])
140 m4_define([msg], [$complex])
141 complex='Not quite as simple |$[1]'
148 AT_CHECK([sed -n '/ -\{44\} /,/ -\{44\} /p' script ]dnl
149 [| sed '1 s/.*## -/## -/; 3 s/- ##.*/- ##/'], [],
150 [[## -------------------------------------------- ##
151 ## Send a simple message, to foobar@example.com ##
152 ## -------------------------------------------- ##
155 AT_CHECK([$CONFIG_SHELL ./script], [], [[
156 ## -------------------------------------------- ##
157 ## Send a simple message, to foobar@example.com ##
158 ## -------------------------------------------- ##
159 ## $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ##
160 ## Send a simple message, to foobar@example.com ##
161 ## $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ##
162 ## ----------------------- ##
163 ## Not quite as simple |$1 ##
164 ## ----------------------- ##
165 ## ,,,,,,,,,,,,,,,,,,,,,,, ##
166 ## Not quite as simple |$1 ##
167 ## ,,,,,,,,,,,,,,,,,,,,,,, ##
173 # Strip path from file.
174 AT_SETUP([AS@&t@_BASENAME])
177 AT_DATA_M4SH([script.as],
180 m4_define([BASENAME_TEST],
181 [base=`AS_BASENAME([$1])`
182 test "$base" = "$2" ||
183 echo "basename($1) = $base instead of $2" >&2
185 base=`_AS_BASENAME_SED([$1])`
186 test "$base" = "$2" ||
187 echo "basename_sed($1) = $base instead of $2" >&2])
189 BASENAME_TEST([//1], [1])
190 BASENAME_TEST([/1], [1])
191 BASENAME_TEST([./1], [1])
192 BASENAME_TEST([../../2], [2])
193 BASENAME_TEST([//1/], [1])
194 BASENAME_TEST([/1/], [1])
195 BASENAME_TEST([./1/], [1])
196 BASENAME_TEST([../../2], [2])
197 BASENAME_TEST([//1/3], [3])
198 BASENAME_TEST([/1/3], [3])
199 BASENAME_TEST([./1/3], [3])
200 BASENAME_TEST([../../2/3], [3])
201 BASENAME_TEST([//1/3///], [3])
202 BASENAME_TEST([/1/3///], [3])
203 BASENAME_TEST([./1/3///], [3])
204 BASENAME_TEST([../../2/3///], [3])
205 BASENAME_TEST([//1//3/], [3])
206 BASENAME_TEST([/1//3/], [3])
207 BASENAME_TEST([./1//3/], [3])
208 BASENAME_TEST([a.c], [a.c])
209 BASENAME_TEST([a.c/], [a.c])
210 BASENAME_TEST([/a.c/], [a.c])
211 BASENAME_TEST([/1/a.c], [a.c])
212 BASENAME_TEST([/1/a.c/], [a.c])
213 BASENAME_TEST([/1/../a.c], [a.c])
214 BASENAME_TEST([/1/../a.c/], [a.c])
215 BASENAME_TEST([./1/a.c], [a.c])
216 BASENAME_TEST([./1/a.c/], [a.c])
221 AT_CHECK([$CONFIG_SHELL ./script])
230 # Strip filename component.
231 AT_SETUP([AS@&t@_DIRNAME])
234 AT_DATA_M4SH([script.as],
237 # The EXPR variant is allowed to fail if `expr' was considered as too
238 # weak for us, in which case `as_expr=false'.
239 m4_define([DIRNAME_TEST],
240 [dir=`AS_DIRNAME([$1])`
241 test "$dir" = "$2" || (test -n "$3" && test "$dir" = "$3") ||
242 echo "dirname($1) = $dir instead of $2" >&2
244 if test "$as_expr" != false; then
245 dir=`_AS_DIRNAME_EXPR([$1])`
246 test "$dir" = "$2" || (test -n "$3" && test "$dir" = "$3") ||
247 echo "dirname_expr($1) = $dir instead of $2" >&2
250 dir=`_AS_DIRNAME_SED([$1])`
251 test "$dir" = "$2" || (test -n "$3" && test "$dir" = "$3") ||
252 echo "dirname_sed($1) = $dir instead of $2" >&2])
254 DIRNAME_TEST([/], [/])
255 DIRNAME_TEST([//], [//], [/])
256 DIRNAME_TEST([///], [/])
257 DIRNAME_TEST([//1], [//], [/])
258 DIRNAME_TEST([/1], [/])
259 DIRNAME_TEST([./1], [.])
260 DIRNAME_TEST([../../2], [../..])
261 DIRNAME_TEST([//1/], [//], [/])
262 DIRNAME_TEST([/1/], [/])
263 DIRNAME_TEST([./1/], [.])
264 DIRNAME_TEST([../../2], [../..])
265 DIRNAME_TEST([//1/3], [//1])
266 DIRNAME_TEST([/1/3], [/1])
267 DIRNAME_TEST([./1/3], [./1])
268 DIRNAME_TEST([../../2/3], [../../2])
269 DIRNAME_TEST([//1/3///], [//1])
270 DIRNAME_TEST([/1/3///], [/1])
271 DIRNAME_TEST([./1/3///], [./1])
272 DIRNAME_TEST([../../2/3///], [../../2])
273 DIRNAME_TEST([//1//3/], [//1])
274 DIRNAME_TEST([/1//3/], [/1])
275 DIRNAME_TEST([./1//3/], [./1])
276 DIRNAME_TEST([../../2//3/], [../../2])
281 AT_CHECK([$CONFIG_SHELL ./script])
286 ## ---------------- ##
287 ## AS_SET_CATFILE. ##
288 ## ---------------- ##
290 AT_SETUP([AS@&t@_SET_CATFILE])
293 AT_DATA_M4SH([script.as],
296 # CATFILE_TEST(DIR, FILE, EXPECTED)
297 m4_define([CATFILE_TEST],
298 [# AS_SET_CATFILE works and can be used in a compound list.
299 if AS_SET_CATFILE([var], [$1], [$2]) \
300 && test "$var" = $3; then :; else
301 echo "catfile($1, $2) = $var != $3" >&2
303 # AS_SET_CATFILE can use non-literals in its arguments.
307 if AS_SET_CATFILE([$varname], [$dirpart], [$filepart]) \
308 && test "$var2" = $3; then :; else
309 echo "catfile($dirpart, $filepart) = $var2 != $3" >&2
313 CATFILE_TEST([dir], [file], [dir/file])
314 CATFILE_TEST([.], [file], [file])
315 CATFILE_TEST([dir], [.], [dir])
316 CATFILE_TEST([dir], [/abs/file], [/abs/file])
317 CATFILE_TEST([dir], [C:/abs/file], [C:/abs/file])
318 CATFILE_TEST(["dir name"], ['file name'], ['dir name/file name'])
324 AT_CHECK([$CONFIG_SHELL ./script])
333 # Print literal strings, with/without newline.
334 AT_SETUP([AS@&t@_ECHO and AS@&t@_ECHO_N])
337 AT_DATA_M4SH([script.as],
340 m4_define([ECHO_TEST],
341 [echo=`AS_ECHO(['$1'])`
342 test "X$echo" = 'X$1' ||
343 echo "AS@&t@_ECHO('"'$1'"') outputs '$echo'" >&2
345 echo=`AS_ECHO_N(['$1'])`
346 test "X$echo" = 'X$1' ||
347 echo "AS@&t@_ECHO_N('"'$1'"') outputs '$echo'" >&2])
351 ECHO_TEST([---...---])
360 ECHO_TEST([\a\b\c\f\n\r\t\v\"\])
372 AT_CHECK([$CONFIG_SHELL ./script])
382 # Exit scripts with given status.
383 AT_SETUP([AS@&t@_EXIT])
384 AT_KEYWORDS([m4sh AS@&t@_SET_STATUS])
386 AT_DATA_M4SH([script.as],
388 test x${1} = xa && AS_EXIT
389 test x${1} = xb && AS_EXIT([${2}])
390 test x${1} = xc && { AS_SET_STATUS([${2}]); AS_EXIT; }
391 test x${1} = xd && trap 's=$?; echo $s; AS_EXIT([$s])' 0
392 test x${2} = xe && set -e
393 test $[#] -gt 0 || AS_EXIT
395 dnl Solaris /bin/sh 'set -e' doesn't react to failed function calls
397 && { echo 'skipping rest of test: set -e support is lousy'; exit 77; }
402 AT_CHECK([$CONFIG_SHELL ./script], [1])
403 AT_CHECK([$CONFIG_SHELL ./script ''], [4])
404 AT_CHECK([$CONFIG_SHELL ./script a], [0])
405 AT_CHECK([$CONFIG_SHELL ./script b], [0])
406 AT_CHECK([$CONFIG_SHELL ./script b 0], [0])
407 AT_CHECK([$CONFIG_SHELL ./script b 2], [2])
408 AT_CHECK([$CONFIG_SHELL ./script c 0], [0])
409 AT_CHECK([$CONFIG_SHELL ./script c 2], [2])
410 AT_CHECK([$CONFIG_SHELL ./script d], [4], [[4
412 dnl If we got to this point without a FAIL, then AS_EXIT at least works.
413 dnl The rest of this test relies on semi-decent 'set -e' support, even
414 dnl though m4sh in general should not try to rely on it because of
415 dnl portability nightmares on what constructs are considered errors across
416 dnl various shells; therefore, an overall SKIP result is desirable on
417 dnl broken shells like Solaris /bin/sh.
418 AT_CHECK([$CONFIG_SHELL ./script '' e], [3])
419 AT_CHECK([$CONFIG_SHELL ./script d e], [3], [stdout])
420 dnl NetBSD sh fails to output on stderr here.
421 AT_CHECK([grep 3 stdout || exit 77], [], [ignore])
432 AT_SETUP([AS@&t@_MKDIR_P])
435 AT_DATA_M4SH([script.as],
441 AS_MKDIR_P(["$pwd/1/2/3/4/5/6"])
442 test -d "$pwd/1/2/3/4/5/6" ||
443 AS_ERROR([$pwd/1/2/3/4/5/6 has not been properly created])
445 AS_MKDIR_P(["a/b/c/d/e/f"])
446 test -d a/b/c/d/e/f ||
447 AS_ERROR([a/b/c/d/e/f has not been properly created])
452 AT_CHECK([$CONFIG_SHELL ./script])
459 ## -------------------- ##
460 ## AS_VERSION_COMPARE. ##
461 ## -------------------- ##
463 # Three-way version comparison.
464 AT_SETUP([AS@&t@_VERSION_COMPARE])
467 AT_DATA_M4SH([script.as],
470 m4_define([VERSION_COMPARE_TEST],
471 [AS_VERSION_COMPARE([$1], [$3], [result='<'], [result='='], [result='>'])
472 test "X$result" = "X$2" ||
473 AS_ERROR([version $1 $result $3; should be $1 $2 $3])
475 [AS_VERSION_COMPARE([$3], [$1], [result='<'], [result='='], [result='>'])
476 test "X$result" = "X>" ||
477 AS_ERROR([version $3 $result $1; should be $3 > $1])])])
479 VERSION_COMPARE_TEST([], =, [])
480 VERSION_COMPARE_TEST([1.0], =, [1.0])
481 VERSION_COMPARE_TEST([alpha-1.0], =, [alpha-1.0])
483 # These tests are taken from libc/string/tst-svc.expect.
485 000 001 00 00a 01 01a 0 0a 2.8 2.8-0.4 20 21 22 212 CP037 CP345 CP1257
486 foo foo-0.4 foo-0.4a foo-0.4b foo-0.5 foo-0.10.5 foo-3.01 foo-3.0
487 foo-3.0.0 foo-3.0.1 foo-3.2 foo-3.10 foo00 foo0
490 for test2 in $tst_svc_expect; do
491 VERSION_COMPARE_TEST([$test1], <, [$test2])
499 AT_CHECK([$CONFIG_SHELL ./script])
513 AT_DATA_M4SH([script.as],
516 test "$as_me" = script || AS_ECHO([["incorrect value of \$as_me: $as_me"]])
520 AT_CHECK([$CONFIG_SHELL ./script])
527 ## ----------------------------- ##
528 ## Negated classes in globbing. ##
529 ## ----------------------------- ##
531 # It is known that `[^...]' is not universally supported, but it is
532 # unknown for `[!...]'.
534 AT_SETUP([Negated classes in globbing])
537 AT_DATA_M4SH([script.as],
540 case 'with!two!bangs' in
542 *) AS_ERROR([[`*[!a-z]*' didn't match `with!two!bangs']]);;
546 *[[!a-z]]*) AS_ERROR([[`*[!a-z]*' matched `without']]);;
551 AT_CHECK([$CONFIG_SHELL ./script])
558 ## ------------------- ##
559 ## Functions Support. ##
560 ## ------------------- ##
562 # Hypothesis: the shell we are running, after having checked for
563 # $LINENO support, supports functions.
565 AT_SETUP([Functions Support])
568 AT_DATA_M4SH([script.as],
584 if func_success; then
585 if func_failure; then
586 AS_ERROR([func_failure passed])
589 AS_ERROR([func_success failed])
594 AT_CHECK([$CONFIG_SHELL ./script])
601 ## ------------------------------ ##
602 ## Functions and return Support. ##
603 ## ------------------------------ ##
605 # Hypothesis: the shell we are running, after having checked for
606 # $LINENO support, supports functions, and the `return' keyword.
608 AT_SETUP([Functions and return Support])
611 AT_DATA_M4SH([script.as],
623 if func_success; then
624 if func_failure; then
625 AS_ERROR([func_failure passed])
628 AS_ERROR([func_success failed])
633 AT_CHECK([$CONFIG_SHELL ./script])
638 ## --------------------------- ##
639 ## Nested AS_REQUIRE_SHELL_FN. ##
640 ## --------------------------- ##
642 # Hypothesis: M4sh expands nested AS_REQUIRE_SHELL_FN
645 AT_SETUP([Nested AS@&t@_REQUIRE_SHELL_FN])
648 AT_DATA_M4SH([script.as], [[dnl
649 m4_define([INIT], [oops])dnl
652 m4_defun([TEST_FUNC2_BODY], [
656 m4_defun([TEST_FUNC1_BODY], [
657 AS_REQUIRE_SHELL_FN([test_func2], [], [TEST_FUNC2_BODY])
661 AS_REQUIRE_SHELL_FN([test_func1], [], [TEST_FUNC1_BODY])
666 AT_CHECK([$CONFIG_SHELL ./script])
671 ## ------------------- ##
672 ## Nested AS_REQUIRE. ##
673 ## ------------------- ##
675 # Hypothesis: M4sh expands the requirements of AS_REQUIRE in the
676 # requested diversion, even if other AS_REQUIREs are interleaved.
678 AT_SETUP([Nested AS@&t@_REQUIRE])
681 AT_DATA_M4SH([script.as], [[dnl
684 m4_defun([in_fn_diversion], still_in_m4sh_init_fn=yes)
685 m4_defun([not_in_fn_diversion], still_in_m4sh_init_fn=no)
687 m4_defun([NESTED], [nested_require_in_fn_diversion=$still_in_m4sh_init_fn])
689 m4_defun([OUTER], [AS_REQUIRE([NESTED])dnl
690 outer_require_in_fn_diversion=$still_in_m4sh_init_fn])
692 m4_defun([test_init], [
693 AS_REQUIRE([in_fn_diversion], , [M4SH-INIT-FN])
694 AS_REQUIRE([OUTER], , [M4SH-INIT-FN])
695 AS_REQUIRE([not_in_fn_diversion], , [M4SH-INIT-FN])
699 if test $outer_require_in_fn_diversion != yes; then AS_EXIT([1]); fi
700 if test $nested_require_in_fn_diversion != no; then AS_EXIT([1]); fi
704 AT_CHECK([$CONFIG_SHELL ./script])
709 ## ------------------------------------ ##
710 ## AS_REQUIRE_SHELL_FN and m4_require. ##
711 ## ------------------------------------ ##
713 # Hypothesis: M4sh expands the requirements of AS_REQUIRE_SHELL_FN
714 # in M4SH-INIT-FN. This changed after Autoconf 2.63.
716 AT_SETUP([AS@&t@_REQUIRE_SHELL_FN and m4@&t@_require])
719 AT_DATA_M4SH([script.as], [[dnl
722 m4_defun([in_m4_sh_init], still_in_m4sh_init=yes)
723 m4_defun([not_in_m4_sh_init], still_in_m4sh_init=no)
725 m4_defun([error_if_emitted_in_m4sh_init], [
726 if test x$still_in_m4sh_init = xyes; then
727 AS_ERROR([requirement emitted in M4SH-INIT])
731 m4_defun([TEST_FUNC_BODY], [
732 m4_require([error_if_emitted_in_m4sh_init])
733 : echo in shell function, with parameter = [$]1
737 m4_defun([test_init], [
738 AS_REQUIRE([in_m4_sh_init], , [M4SH-INIT-FN])
739 AS_REQUIRE_SHELL_FN([test_func], [], [TEST_FUNC_BODY])
740 AS_REQUIRE([not_in_m4_sh_init])
748 AT_CHECK([$CONFIG_SHELL ./script])
757 AT_SETUP([AS@&t@_HELP_STRING])
758 AT_KEYWORDS([m4sh m4@&t@_text_wrap m4@&t@_expand])
760 AT_DATA_M4SH([script.as],
763 echo "AS_HELP_STRING([--an-option],[some text])"
764 echo "AS_HELP_STRING([--another-much-longer-option],
765 [some other text which should wrap at our default of 80 characters.])"
766 echo "AS_HELP_STRING([--fooT=barT], [foo bar])"
767 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@], [foo bar])"
768 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@123456789], [foo bar])"
769 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@1234567890], [foo bar])"
770 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@12345678901], [foo bar])"
771 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@123456789012], [foo bar])"
772 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@1234567890123], [foo bar])"
773 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@],
774 [some other text which should wrap at our default of 80 characters.])"
775 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@123456789],
776 [some other text which should wrap at our default of 80 characters.])"
777 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@1234567890],
778 [some other text which should wrap at our default of 80 characters.])"
779 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@12345678901],
780 [some other text which should wrap at our default of 80 characters.])"
781 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@123456789012],
782 [some other text which should wrap at our default of 80 characters.])"
783 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@1234567890123],
784 [some other text which should wrap at our default of 80 characters.])"
785 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@],
786 [some other @<][:@ex@:][>@ which should wrap at our default of 80 characters.])"
787 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@123456789],
788 [some other @<][:@ex@:][>@ which should wrap at our default of 80 characters.])"
789 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@1234567890],
790 [some other @<][:@ex@:][>@ which should wrap at our default of 80 characters.])"
791 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@12345678901],
792 [some other @<][:@ex@:][>@ which should wrap at our default of 80 characters.])"
793 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@123456789012],
794 [some other @<][:@ex@:][>@ which should wrap at our default of 80 characters.])"
795 echo "AS_HELP_STRING([--foo@<][:@=bar@:][>@1234567890123],
796 [some other @<][:@ex@:][>@ which should wrap at our default of 80 characters.])"
797 echo "AS_HELP_STRING([[--foo[=bar]]],
798 [some other t[]t which should wrap at our default of 80 characters.])"
799 echo "AS_HELP_STRING([[--foo[=bar]123456789]],
800 [some other t[]t which should wrap at our default of 80 characters.])"
801 echo "AS_HELP_STRING([[--foo[=bar]1234567890]],
802 [some other t[]t which should wrap at our default of 80 characters.])"
803 echo "AS_HELP_STRING([[--foo[=bar]12345678901]],
804 [some other t[]t which should wrap at our default of 80 characters.])"
805 echo "AS_HELP_STRING([[--foo[=bar]123456789012]],
806 [some other t[]t which should wrap at our default of 80 characters.])"
807 echo "AS_HELP_STRING([[--foo[=bar]1234567890123]],
808 [some other t[]t which should wrap at our default of 80 characters.])"
809 m4_define([mac], [MACRO])dnl
810 echo "AS_HELP_STRING([--mac], [mac])"
811 echo "AS_HELP_STRING([--o1, --o2], [two
812 options, one description])"
813 echo "AS_HELP_STRING([[[--o3, --o4]]], [comma inside literal quoting])"
814 echo "AS_HELP_STRING([--tune1], [check out the tuned formatting],
816 echo "AS_HELP_STRING([--tune2], [check out the tuned formatting],
818 echo "AS_HELP_STRING([--tune3], [check out the tuned formatting],
820 echo "AS_HELP_STRING([--tune4], [check out the tuned formatting],
825 AT_CHECK([$CONFIG_SHELL ./script], [0],
826 [[ --an-option some text
827 --another-much-longer-option
828 some other text which should wrap at our default of
832 --foo[=bar]123456789 foo bar
833 --foo[=bar]1234567890 foo bar
834 --foo[=bar]12345678901 foo bar
835 --foo[=bar]123456789012 foo bar
836 --foo[=bar]1234567890123
838 --foo[=bar] some other text which should wrap at our default of
840 --foo[=bar]123456789 some other text which should wrap at our default of
842 --foo[=bar]1234567890 some other text which should wrap at our default of
844 --foo[=bar]12345678901 some other text which should wrap at our default of
846 --foo[=bar]123456789012 some other text which should wrap at our default of
848 --foo[=bar]1234567890123
849 some other text which should wrap at our default of
851 --foo[=bar] some other [ex] which should wrap at our default of
853 --foo[=bar]123456789 some other [ex] which should wrap at our default of
855 --foo[=bar]1234567890 some other [ex] which should wrap at our default of
857 --foo[=bar]12345678901 some other [ex] which should wrap at our default of
859 --foo[=bar]123456789012 some other [ex] which should wrap at our default of
861 --foo[=bar]1234567890123
862 some other [ex] which should wrap at our default of
864 --foo[=bar] some other t[]t which should wrap at our default of
866 --foo[=bar]123456789 some other t[]t which should wrap at our default of
868 --foo[=bar]1234567890 some other t[]t which should wrap at our default of
870 --foo[=bar]12345678901 some other t[]t which should wrap at our default of
872 --foo[=bar]123456789012 some other t[]t which should wrap at our default of
874 --foo[=bar]1234567890123
875 some other t[]t which should wrap at our default of
878 --o1, --o2 two options, one description
879 [--o3, --o4] comma inside literal quoting
880 --tune1 check out the tuned formatting
881 --tune2 check out the tuned formatting
882 --tune3 check out the
885 --tune4 check out the tuned
892 ## ------------------- ##
893 ## AS_IF and AS_CASE. ##
894 ## ------------------- ##
896 AT_SETUP([AS@&t@_IF and AS@&t@_CASE])
897 AT_KEYWORDS([m4sh m4@&t@_map_args_pair])
899 AT_DATA_M4SH([script.as], [[dnl
901 # Syntax checks: cope with empty arguments.
902 AS_IF([:], [], [echo wrong])
903 AS_IF([:], [echo one], [echo wrong])
904 AS_IF([false], [echo wrong], [echo two])
905 AS_IF([false], [echo wrong])
907 AS_IF([false], [echo wrong],
909 AS_IF([false], [echo wrong],
912 AS_IF([false], [echo wrong],
913 [false], [echo wrong])
914 AS_IF([false], [echo wrong],
915 [false], [echo wrong],
917 AS_IF([false], [echo wrong],
918 [false], [echo wrong],
922 AS_CASE([foo], [echo seven])
934 # check for nesting, lists, and side effects, and quoting robustness
936 AS_IF([AS_IF([$empty], [echo eleven])]) && AS_CASE([foo]) && echo twelve
938 AS_IF([touch file; false]) && echo thirteen
939 test -f file && echo fourteen
941 AS_CASE([`touch file; false`]) && test -f file && echo fifteen
942 dnl The next line is badly underquoted; don't intentionally copy this style.
943 AS_CASE([foo], [foo], m4_do(AS_CASE([bar], [bar], [echo sixteen])))
944 dnl Handle blank arguments.
945 AS_IF([false], [:], [ ]) && AS_CASE([foo], [foo], []
947 m4_define([empty])AS_IF([:], [empty]
948 ) && AS_CASE([foo], [foo], [empty]) && echo eighteen
949 dnl We can't handle AS_IF([false], [:], [empty]) unless m4_expand is
950 dnl taught how to handle m4_require. The user is responsible for
951 dnl avoiding the syntax error in that case.
953 # check that require works correctly
954 m4_for([n], 1, 9, [],
955 [m4_defun([FOO]n, [foo]n[=]n)dnl
957 [m4_require([FOO]]n[)dnl
962 echo "foo1=$foo1 bar1=$bar1"
963 AS_IF([:], [], [BAR2])
964 echo "foo2=$foo2 bar2=$bar2"
965 AS_IF([false], [BAR3])
966 echo "foo3=$foo3 bar3=$bar3"
967 AS_IF([false], [], [BAR4])
968 echo "foo4=$foo4 bar4=$bar4"
969 AS_CASE([x], [x], [BAR5])
970 echo "foo5=$foo5 bar5=$bar5"
971 AS_CASE([x], [y], [BAR6])
972 echo "foo6=$foo6 bar6=$bar6"
976 echo "foo7=$foo7 bar7=$bar7"
980 echo "foo8=$foo8 bar8=$bar8"
984 echo "foo9=$foo9 bar9=$bar9"
988 AT_CHECK([$CONFIG_SHELL ./script], [0], [[one
1017 dnl stress test for large number of conditionals
1018 dnl too large, and we start tickling shell bugs
1019 m4_pushdef([limit], [1000])dnl
1020 AT_DATA_M4SH([script.as], [[dnl
1022 AS_IF(m4_shift(m4_for([i], [1], ]limit[, [], [, test $[1] = i, echo i])))
1023 AS_IF(m4_shift(m4_for([i], [1], ]limit[, [], [, test $[1] = i, echo i])),
1025 AS_CASE([$[1]]m4_for([i], [1], ]limit[, [], [, i, echo i]))
1026 AS_CASE([$[1]]m4_for([i], [1], ]limit[, [], [, i, echo i]), [echo default])
1029 dnl Add --force so autom4te doesn't think `script' is still up to date.
1030 AT_CHECK_M4SH([--force])
1031 AT_CHECK([$CONFIG_SHELL ./script 1], [0], [[1
1036 AT_CHECK([$CONFIG_SHELL ./script limit], [0], [limit
1041 AT_CHECK([$CONFIG_SHELL ./script default], [0], [[default
1053 AT_SETUP([AS@&t@_FOR])
1056 AT_DATA_M4SH([script.as], [[dnl
1060 AS_FOR([m4var], [shvar], [a],
1061 [echo "m4var $shvar"])
1062 AS_FOR([m4var], [shvar], [b c],
1063 [echo "m4var $shvar"])
1065 AS_FOR([m4var], [shvar], [$list],
1066 [echo "m4var $shvar"])
1067 AS_FOR([m4var], [shvar], ["$list"],
1068 [echo "m4var $shvar"])
1069 AS_FOR([m4var], [shvar], ['$list'],
1070 [echo "m4var $shvar"])
1071 AS_FOR([m4var], [shvar], [\'],
1072 [echo "m4var $shvar"])
1074 # Syntax checks: cope with empty/blank arguments.
1076 AS_FOR([], [shvar], [],
1077 [echo "m4_defn([]) $shvar"])
1079 AS_FOR([], [shvar], [`touch file`])
1080 test -f file || exit 1
1081 AS_FOR([], [shvar], [], [ ])
1082 m4_define([empty])AS_FOR([], [shvar], [], [empty])
1084 # Check that break works.
1087 AS_FOR([m4var], [shvar], [h i],
1088 [echo "m4var"; break 2])
1093 AS_FOR([m4var], [shvar], [j],
1094 [echo "m4var"; break 2])
1100 AT_CHECK([$CONFIG_SHELL ./script], [0], [[a a
1117 ## --------------- ##
1118 ## AS_LITERAL_IF. ##
1119 ## --------------- ##
1121 AT_SETUP([AS@&t@_LITERAL_IF])
1122 AT_KEYWORDS([m4sh AS@&t@_LITERAL_WORD_IF AS@&t@_LITERAL_HEREDOC_IF])
1124 AT_DATA_M4SH([script.as], [[dnl
1126 echo AS_LITERAL_IF([lit], [ok], [ERR]) 1
1127 echo AS_LITERAL_IF([l-/.it], [ok], [ERR]) 2
1128 echo AS_LITERAL_IF([l''it], [ERR], [ok]) 3
1129 echo AS_LITERAL_IF([l$it], [ERR], [ok]) 4
1130 echo AS_LITERAL_IF([l$it], [ERR1], [ERR2], [ok]) 5
1131 echo AS_LITERAL_IF([l${it}], [ERR1], [ERR2], [ok]) 6
1132 echo AS_LITERAL_IF([l`case a in b) ;; esac`it], [ERR], [ok]) 7
1133 echo AS_LITERAL_IF([l`case a in b) ;; esac`it], [ERR1], [ok], [ERR2]) 8
1134 m4_define([mac], [l-/.it])
1135 echo AS_LITERAL_IF([mac], [ok], [ERR]) 9
1136 echo AS_LITERAL_IF([mac($, ``)], [ok], [ERR]) 10
1137 m4_define([mac], [l$it])
1138 echo AS_LITERAL_IF([mac], [ERR], [ok]) 11
1139 echo AS_LITERAL_IF([mac], [ERR1], [ERR2], [ok]) 12
1140 m4_define([mac], [l``it])
1141 echo AS_LITERAL_IF([mac], [ERR], [ok]) 13
1142 echo AS_LITERAL_IF([mac], [ERR1], [ok], [ERR2]) 14
1143 echo AS_LITERAL_IF([ a ][
1145 echo AS_LITERAL_WORD_IF([ a ][
1147 echo AS_LITERAL_HEREDOC_IF([ a ][
1149 echo AS_LITERAL_IF([(a)], [ERR], [ok]) 18
1150 echo AS_LITERAL_WORD_IF([(a)], [ERR], [ok]) 19
1151 echo AS_LITERAL_HEREDOC_IF([(a)], [ok], [ERR]) 20
1152 echo AS_LITERAL_IF([@S|@a], [ERR], [ok]) 21
1153 echo AS_LITERAL_WORD_IF([@S|@a], [ERR], [ok]) 22
1154 echo AS_LITERAL_HEREDOC_IF([@S|@a], [ERR], [ok]) 23
1158 AT_CHECK([$CONFIG_SHELL ./script], [],
1187 ## --------------------- ##
1188 ## AS_TR_SH, AS_TR_CPP. ##
1189 ## --------------------- ##
1191 AT_SETUP([AS@&t@_TR_SH and AS@&t@_TR_CPP])
1193 AT_DATA_M4SH([script.as], [[dnl
1195 m4_define([abc], [hI])m4_define([ABC], [Hi])
1196 m4_define([hi], [oops])m4_define([HI], [OOPS])
1197 echo AS_TR_SH(abc) AS_TR_SH(aBc) AS_TR_SH(ABC)
1198 echo AS_TR_SH([abc]) AS_TR_SH([aBc]) AS_TR_SH([ABC])
1199 echo AS_TR_SH([[abc]]) AS_TR_SH([[aBc]]) AS_TR_SH([[ABC]])
1200 echo AS_TR_CPP(abc) AS_TR_CPP(aBc) AS_TR_CPP(ABC)
1201 echo AS_TR_CPP([abc]) AS_TR_CPP([aBc]) AS_TR_CPP([ABC])
1202 echo AS_TR_CPP([[abc]]) AS_TR_CPP([[aBc]]) AS_TR_CPP([[ABC]])
1204 [var=abc vAr=aBc VAR=ABC]
1205 echo AS_TR_SH($var) AS_TR_SH($vAr) AS_TR_SH($VAR)
1206 echo AS_TR_SH([$var]) AS_TR_SH([$vAr]) AS_TR_SH([$VAR])
1207 echo AS_TR_SH([[$var]]) AS_TR_SH([[$vAr]]) AS_TR_SH([[$VAR]])
1208 echo AS_TR_CPP($var) AS_TR_CPP($vAr) AS_TR_CPP($VAR)
1209 echo AS_TR_CPP([$var]) AS_TR_CPP([$vAr]) AS_TR_CPP([$VAR])
1210 echo AS_TR_CPP([[$var]]) AS_TR_CPP([[$vAr]]) AS_TR_CPP([[$VAR]])
1212 echo AS_TR_SH(`echo abc`) AS_TR_SH(`echo aBc`) AS_TR_SH(`echo ABC`)
1213 echo AS_TR_SH([`echo abc`]) AS_TR_SH([`echo aBc`]) AS_TR_SH([`echo ABC`])
1214 echo AS_TR_SH([[`echo abc`]]) AS_TR_SH([[`echo aBc`]]) AS_TR_SH([[`echo ABC`]])
1215 echo AS_TR_CPP(`echo abc`) AS_TR_CPP(`echo aBc`) AS_TR_CPP(`echo ABC`)
1216 echo AS_TR_CPP([`echo abc`]) AS_TR_CPP([`echo aBc`]) AS_TR_CPP([`echo ABC`])
1217 echo AS_TR_CPP([[`echo abc`]]) AS_TR_CPP([[`echo aBc`]]) AS_TR_CPP([[`echo ABC`]])
1219 echo AS_TR_SH([a.b/c+*-])
1220 echo AS_TR_CPP([a.b/c+*-])
1222 echo AS_TR_SH([$var])
1223 echo AS_TR_CPP([$var])
1224 m4_define([macro], [a.b/c+*-])
1225 echo AS_TR_SH([macro])
1226 echo AS_TR_CPP([macro])
1230 AT_CHECK([$CONFIG_SHELL ./script], [],
1267 AT_SETUP([AS@&t@_VAR basics])
1268 AT_KEYWORDS([m4sh AS@&t@_VAR_COPY AS@&t@_VAR_SET AS@&t@_VAR_GET])
1269 AT_KEYWORDS([AS@&t@_VAR_TEST_SET AS@&t@_VAR_SET_IF AS@&t@_VAR_IF])
1270 AT_KEYWORDS([AS@&t@_VAR_PUSHDEF AS@&t@_VAR_POPDEF])
1272 AT_DATA_M4SH([script.as], [[dnl
1274 m4_define([with], [WITH])
1276 dnl AS_VAR_SET_IF also covers AS_VAR_TEST_SET
1277 AS_VAR_SET_IF([foo], [echo oops]) && echo ok
1278 AS_VAR_SET([foo], ['\a "weird" `value` with; $fun '\''characters
1280 AS_VAR_COPY([bar], [foo])
1282 AS_ECHO(["AS_VAR_GET([foo])-"])
1283 AS_VAR_SET_IF([foo], [echo ok], [echo oops])
1284 AS_VAR_IF([foo], [string], [echo oops]) && echo ok
1285 AS_VAR_PUSHDEF([tmp], [foo])
1286 AS_VAR_IF([tmp], ['\a "weird" `value` with; $fun '\''characters
1287 '], [echo ok], [echo oops]) # 'font-lock
1288 AS_VAR_POPDEF([tmp])
1289 m4_ifdef([tmp], [echo oops])
1291 # Indirects via shell vars.
1294 AS_VAR_SET_IF([foo$num], [echo oops]) && echo ok
1295 AS_VAR_SET([foo$num], ['\a "weird" `value` with; $fun '\''characters
1297 AS_VAR_COPY([bar], [foo$num])
1299 AS_VAR_COPY([foo$num], [bar])
1301 AS_ECHO(["AS_VAR_GET([foo$num])-"])
1302 AS_VAR_SET_IF([foo$num], [echo ok], [echo oops])
1303 AS_VAR_IF([foo$num], [string], [echo oops]) && echo ok
1304 AS_VAR_PUSHDEF([tmp], [foo$num])
1305 AS_VAR_IF([tmp], ['\a "weird" `value` with; $fun '\''characters
1306 '], [echo ok], [echo oops]) # 'font-lock
1307 AS_VAR_POPDEF([tmp])
1308 m4_ifdef([tmp], [echo oops])
1310 # Indirects via command substitution.
1312 AS_VAR_SET_IF([`echo foo3`], [echo oops]) && echo ok
1313 AS_VAR_SET([`echo foo3`], ['\a "weird" `value` with; $fun '\''characters
1315 AS_VAR_COPY([bar], [`echo foo3`])
1317 AS_VAR_COPY([`echo foo4`], [bar])
1319 AS_ECHO(["AS_VAR_GET([`echo foo4`])-"])
1320 AS_VAR_SET_IF([`echo foo4`], [echo ok], [echo oops])
1321 AS_VAR_IF([`echo foo4`], [string], [echo oops]) && echo ok
1322 AS_VAR_PUSHDEF([tmp], [`echo foo4`])
1323 AS_VAR_IF([tmp], ['\a "weird" `value` with; $fun '\''characters
1324 '], [echo ok], [echo oops]) # 'font-lock
1325 AS_VAR_POPDEF([tmp])
1326 m4_ifdef([tmp], [echo oops])
1331 AT_CHECK([$CONFIG_SHELL ./script], [], [[ok
1332 \a "weird" `value` WITH; $fun 'characters
1334 \a "weird" `value` WITH; $fun 'characters
1341 \a "weird" `value` WITH; $fun 'characters
1343 \a "weird" `value` WITH; $fun 'characters-
1349 \a "weird" `value` WITH; $fun 'characters
1351 \a "weird" `value` WITH; $fun 'characters-
1360 ## --------------- ##
1361 ## AS_VAR_APPEND. ##
1362 ## --------------- ##
1364 AT_SETUP([AS@&t@_VAR_APPEND])
1365 AT_KEYWORDS([m4sh AS@&t@_VAR])
1367 AT_DATA_M4SH([script.as], [[dnl
1370 AS_VAR_APPEND([foo], ["hello, "])
1371 AS_VAR_APPEND([foo], [world])
1373 # Indirects via shell vars.
1375 AS_VAR_APPEND([foo$num], ['hello, '])
1376 AS_VAR_APPEND([foo$num], [`echo "world"`])
1378 # Indirects via command substitution.
1380 AS_VAR_APPEND([`echo foo2`], [${h}])
1381 AS_VAR_APPEND([`echo foo2`], ["$w"])
1386 AT_CHECK([$CONFIG_SHELL ./script], [],
1395 ## -------------- ##
1397 ## -------------- ##
1399 AT_SETUP([AS@&t@_VAR_ARITH])
1400 AT_KEYWORDS([m4sh AS@&t@_VAR])
1402 AT_DATA_M4SH([script.as], [[dnl
1405 AS_VAR_ARITH([foo], [1 + 1])
1407 # Indirects via shell vars.
1409 AS_VAR_ARITH([foo$num], [\( 2 + 3 \) \* 4])
1411 # Indirects via command substitution.
1412 AS_VAR_ARITH([`echo foo2`], [0 + -2 + $foo1 / 2])
1417 AT_CHECK([$CONFIG_SHELL ./script], [],
1426 ## ----------------- ##
1427 ## AS_INIT cleanup. ##
1428 ## ----------------- ##
1430 AT_SETUP([AS@&t@_INIT cleanup])
1431 AT_KEYWORDS([m4sh m4@&t@_wrap m4@&t@_wrap_lifo])
1433 AT_DATA_M4SH([script.as], [[dnl
1434 dnl Registered before AS_INIT's cleanups
1435 m4_wrap([echo cleanup 1
1437 m4_pushdef([_AS_SHELL_FN_SPY])dnl neutralize the spy, we don't care about it
1439 dnl Registered after AS_INIT's cleanups, thus goes to KILL diversion
1440 m4_wrap([echo cleanup 2
1441 dnl However, nested wraps and diversions can still be used
1442 dnl Also, test wrapping text that looks like parameter reference
1443 m4_wrap([echo cleanup 3
1444 m4_divert_text([M4SH-INIT], [m4_define([foo], [$1])dnl
1447 dnl Registered before AS_INIT's cleanups
1448 m4_wrap_lifo([echo cleanup 5
1454 AT_CHECK([$CONFIG_SHELL ./script], [], [[prep 4
1463 ## ------------------- ##
1464 ## AS_INIT_GENERATED. ##
1465 ## ------------------- ##
1467 AT_SETUP([AS@&t@_INIT_GENERATED])
1468 AT_KEYWORDS([AS@&t@_MESSAGE AS@&t@_MESSAGE_LOG_FD])
1470 dnl First run, no logging, tests shell selection
1471 AT_DATA_M4SH([script.as], [[dnl
1473 AS_INIT_GENERATED([child], [echo hello from child])
1475 AS_ECHO(["SHELL=$SHELL"])
1477 echo hello from parent
1478 AS_ECHO(["SHELL=$SHELL"])
1482 AT_CHECK([$CONFIG_SHELL ./script], [0], [stdout])
1483 AT_CHECK([grep 'SHELL=.' stdout], [0], [ignore])
1484 sed s/parent/child/ <stdout >expout
1485 AT_CHECK([./child], [0], [expout])
1490 AT_CHECK([$CONFIG_SHELL ./script], [0], [expout])
1491 AT_CHECK([cmp child child.bak])
1492 AT_CHECK([grep 'SHELL=.' stdout], [0], [ignore])
1493 sed s/parent/child/ <stdout >expout
1494 AT_CHECK([./child], [0], [expout])
1497 dnl Second run, with logging from parent and child, tests fd handling
1498 AT_DATA_M4SH([script.as], [[dnl
1501 m4_define([AS_MESSAGE_LOG_FD], [5])
1502 exec AS_MESSAGE_LOG_FD>log
1503 AS_INIT_GENERATED([$child], [echo hello1 from $child]) || AS_EXIT([1])
1505 m4_pushdef([AS_MESSAGE_LOG_FD])
1506 AS_MESSAGE([hello2 from ${child}child])
1507 m4_popdef([AS_MESSAGE_LOG_FD])
1508 exec AS_MESSAGE_LOG_FD>>log
1509 AS_MESSAGE([hello3 from child])
1511 AS_MESSAGE([hello from parent])
1512 dnl close log in parent before spawning child, for mingw
1513 exec AS_MESSAGE_LOG_FD>&-
1519 AT_CHECK([$CONFIG_SHELL ./script], [0], [[script: hello from parent
1521 child: hello2 from child
1522 child: hello3 from child
1524 AT_CHECK([[sed 's,:[0-9][0-9]*:,:0:,' log]], [0],
1525 [[script:0: hello from parent
1526 child:0: hello3 from child
1529 # Force write error creating a file on stdout
1530 if test -w /dev/full && test -c /dev/full; then
1531 AT_CHECK([$CONFIG_SHELL ./script /dev/full], [1], [ignore], [ignore])
1537 ## --------------- ##
1538 ## AS_MESSAGE_FD. ##
1539 ## --------------- ##
1541 AT_SETUP([AS@&t@_MESSAGE_FD])
1542 AT_KEYWORDS([AS@&t@_MESSAGE AS@&t@_MESSAGE_LOG_FD AS@&t_ORIGINAL_STDIN_FD])
1543 AT_KEYWORDS([AS@&t@_LINENO_PUSH])
1545 AT_DATA_M4SH([script.as], [[dnl
1547 m4_define([AS_ORIGINAL_STDIN_FD], [5])
1548 m4_define([AS_MESSAGE_LOG_FD], [6])
1549 m4_define([AS_MESSAGE_FD], [7])
1550 exec AS_ORIGINAL_STDIN_FD<&0 </dev/null AS_MESSAGE_LOG_FD>log
1551 if test $[#] -gt 0; then
1552 exec AS_MESSAGE_FD>/dev/null
1554 exec AS_MESSAGE_FD>&1
1556 AS_LINENO_PUSH([100])
1557 cat # tests that stdin is neutralized
1558 AS_MESSAGE([hello world])
1559 cat <&AS_ORIGINAL_STDIN_FD
1563 AT_CHECK([echo goodbye | $CONFIG_SHELL ./script], [0],
1564 [[script: hello world
1567 AT_CHECK([cat log], [0],
1568 [[script:100: hello world
1571 AT_CHECK([echo goodbye | $CONFIG_SHELL ./script silent], [0],
1574 AT_CHECK([cat log], [0],
1575 [[script:100: hello world
1581 ## --------------- ##
1582 ## _AS_CLEAN_DIR. ##
1583 ## --------------- ##
1585 AT_SETUP([_AS@&t@_CLEAN_DIR])
1587 dnl ensure that we can erase all files in a directory. Note that
1588 dnl _AS_CLEAN_DIR needs three globs to catch all these files.
1589 AT_DATA_M4SH([script.as], [[dnl
1591 # Unwritable subdirectories are common during 'make distcheck'.
1592 mkdir sub sub/unwritable || AS_ERROR([failed to mkdir])
1593 touch sub/unwritable/file || AS_ERROR([failed to touch])
1594 chmod a-wx sub/unwritable || AS_ERROR([failed to chmod])
1595 # Cygwin 1.5 can't touch 'sub/...', so make that file optional.
1596 touch sub/a sub/aa sub/aaa sub/.a sub/..a sub/.aa \
1597 || AS_ERROR([failed to touch])
1598 touch sub/... 2>/dev/null
1599 _AS_CLEAN_DIR([sub]) || AS_ERROR([failed to clean])
1600 # rmdir instead of 'rm -fr' here proves that we emptied sub.
1601 rmdir sub || AS_ERROR([failed to rmdir])
1605 AT_CHECK([$CONFIG_SHELL ./script])
1616 AT_DATA_M4SH([script.as], [[dnl
1624 AT_CHECK([$CONFIG_SHELL ./script], [], [foobar