* tests/base.at, tests/compile.at, tests/foreign.at,
* tests/m4sh.at, tests/m4sugar.at, tests/mktests.sh,
* tests/semantics.at, tests/suite.at, tests/tools.at,
* tests/torture.at: Ask Autotest mode, not Autoconf mode.
2001-08-20 22:44:38 +08:00
|
|
|
# -*- Autotest -*-
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
|
2000-11-29 18:12:05 +08:00
|
|
|
AT_BANNER([M4sh.])
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
|
2004-08-21 03:58:06 +08:00
|
|
|
# Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
* AUTHORS, BUGS, ChangeLog, ChangeLog.0, ChangeLog.1,
ChangeLog.2, GNUmakefile, Makefile.maint, NEWS, README,
README-alpha, TODO, configure.ac, lib/autoconf/Makefile.am,
m4/atconfig.m4, m4/init.m4, m4/m4.m4, m4/missing.m4,
m4/sanity.m4, tests/README, tests/aclocal.m4,
tests/atspecific.m4, tests/base.at, tests/compile.at,
tests/foreign.at, tests/m4sh.at, tests/m4sugar.at,
tests/semantics.at, tests/suite.at, tests/tools.at,
tests/torture.at: Add copyright notice.
* tests/mktests.sh: Update year in copyright notice.
2001-08-12 21:05:11 +08:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
# the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
# any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
# 02111-1307, USA.
|
|
|
|
|
2001-10-06 00:12:22 +08:00
|
|
|
## ---------------- ##
|
|
|
|
## LINENO support. ##
|
|
|
|
## ---------------- ##
|
|
|
|
|
|
|
|
AT_SETUP([LINENO])
|
|
|
|
|
2002-04-22 19:15:35 +08:00
|
|
|
# We cannot unset LINENO with Zsh, yet this test case relies on
|
|
|
|
# unsetting LINENO to compare its result when (i) LINENO is supported
|
|
|
|
# and when (ii) it is not.
|
|
|
|
# So just skip if the shell is ZSH.
|
2002-04-22 20:18:36 +08:00
|
|
|
AT_CHECK([test -n "${ZSH_VERSION+set}" && exit 77], ignore)
|
2002-04-22 19:15:35 +08:00
|
|
|
|
2004-08-21 03:58:06 +08:00
|
|
|
# AT_DATA_LINENO(FILE-NAME,
|
2001-10-06 00:12:22 +08:00
|
|
|
# UNSET-LINENO = true | false, COUNTER, COUNTER-RE)
|
|
|
|
# ----------------------------------------------------------------
|
2004-08-21 03:58:06 +08:00
|
|
|
# Produce the FILE-NAME M4sh script which uses the COUNTER LINENO or
|
2002-04-29 21:29:40 +08:00
|
|
|
# _oline_, which we can recognized via COUNTER-RE. Unset LINENO is
|
|
|
|
# UNSET-LINENO.
|
2001-10-06 00:12:22 +08:00
|
|
|
#
|
2002-04-29 21:29:40 +08:00
|
|
|
# Use COUNTER, COUNTER-RE = [__LINENO__], [LINENO]
|
|
|
|
# or = [__OLINE__], [_oline__]
|
|
|
|
#
|
|
|
|
# instead of the obvious $LINENO and __oline__, because they would
|
|
|
|
# be replaced in the test suite itself, even before creating these
|
|
|
|
# scripts. For the same reason, grep for LINENO and _oline__ (sic).
|
2001-10-06 00:12:22 +08:00
|
|
|
#
|
|
|
|
# UNSET-LINENO is a shell condition to make sure the scripts have the
|
|
|
|
# same number of lines in the output, so that their outputs be identical.
|
|
|
|
m4_define([AT_DATA_LINENO],
|
2002-04-29 21:29:40 +08:00
|
|
|
[AT_DATA([$1.tas],
|
2001-11-13 23:18:26 +08:00
|
|
|
[[AS@&t@_INIT
|
2001-10-06 00:12:22 +08:00
|
|
|
if $2; then
|
2001-11-13 23:18:26 +08:00
|
|
|
AS@&t@_UNSET([LINENO])
|
2001-10-06 00:12:22 +08:00
|
|
|
fi
|
2002-04-10 23:58:19 +08:00
|
|
|
_AS@&t@_PREPARE
|
2001-10-06 00:12:22 +08:00
|
|
|
echo "Line: $3"
|
|
|
|
grep 'Line: .*$4' $[0] >/dev/null ||
|
2001-11-13 23:18:26 +08:00
|
|
|
AS@&t@_ERROR([cannot find original script])
|
2001-10-06 00:12:22 +08:00
|
|
|
exit 0
|
|
|
|
]])
|
2002-04-29 21:29:40 +08:00
|
|
|
# If occurrences of $LINENO or __oline__ were wanted, create them.
|
|
|
|
sed 's/__LINENO__/$''LINENO/g;s/__OLINE__/__''oline__/g' $1.tas >$1.as
|
|
|
|
AT_CHECK([autom4te -l m4sh $1.as -o $1])
|
2001-10-06 00:12:22 +08:00
|
|
|
])# AT_DATA_LINENO
|
|
|
|
|
|
|
|
# `_oline_', once processed and ran, produces our reference.
|
2002-04-21 15:25:20 +08:00
|
|
|
# We check that we find ourselves by looking at a string which is
|
2001-10-06 00:12:22 +08:00
|
|
|
# available only in the original script: `_oline_'.
|
2002-04-29 21:29:40 +08:00
|
|
|
AT_DATA_LINENO([reference], [false], [__OLINE__], [_oline__])
|
2001-10-06 00:12:22 +08:00
|
|
|
AT_CHECK([./reference], 0, [stdout])
|
|
|
|
|
|
|
|
# The reference:
|
|
|
|
mv stdout expout
|
|
|
|
|
|
|
|
# Now using a maybe-functioning LINENO, with different call conventions.
|
|
|
|
# Be sure to be out of the PATH.
|
|
|
|
AT_CHECK([mkdir test || exit 77])
|
|
|
|
|
2002-04-29 21:29:40 +08:00
|
|
|
AT_DATA_LINENO([test/test-1], [false], [__LINENO__], [LINENO])
|
2002-01-28 18:46:00 +08:00
|
|
|
AT_CHECK([./test/test-1], 0, [expout])
|
2002-03-26 06:02:24 +08:00
|
|
|
AT_CHECK([(PATH=test$PATH_SEPARATOR$PATH; export PATH; exec test-1)],
|
|
|
|
0, [expout])
|
2002-01-28 18:46:00 +08:00
|
|
|
AT_CHECK([sh ./test/test-1], 0, [expout])
|
2001-10-06 00:12:22 +08:00
|
|
|
|
|
|
|
# Now using a disabled LINENO, with different call conventions.
|
2002-04-29 21:29:40 +08:00
|
|
|
AT_DATA_LINENO([test/test-2], [true], [__LINENO__], [LINENO])
|
2002-01-28 18:46:00 +08:00
|
|
|
AT_CHECK([./test/test-2], 0, [expout])
|
2002-03-26 06:02:24 +08:00
|
|
|
AT_CHECK([(PATH=test$PATH_SEPARATOR$PATH; export PATH; exec test-2)],
|
|
|
|
0, [expout])
|
2002-01-28 18:46:00 +08:00
|
|
|
AT_CHECK([sh ./test/test-2], 0, [expout])
|
2001-10-06 00:12:22 +08:00
|
|
|
|
2002-04-22 18:23:12 +08:00
|
|
|
AT_CLEANUP
|
|
|
|
|
2001-10-06 00:12:22 +08:00
|
|
|
|
|
|
|
|
2001-10-08 16:21:54 +08:00
|
|
|
## ------------ ##
|
|
|
|
## AS_DIRNAME. ##
|
|
|
|
## ------------ ##
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
|
|
|
|
# Build nested dirs.
|
2001-10-08 16:21:54 +08:00
|
|
|
AT_SETUP([[AS@&t@_DIRNAME]])
|
2001-05-31 15:02:13 +08:00
|
|
|
|
2001-10-08 16:21:54 +08:00
|
|
|
AT_DATA_M4SH([script.as],
|
|
|
|
[[AS_INIT
|
2000-11-29 23:52:02 +08:00
|
|
|
|
2001-10-08 16:21:54 +08:00
|
|
|
# The EXPR variant is allowed to fail if `expr' was considered as too
|
|
|
|
# weak for us, in which case `as_expr=false'.
|
2001-08-20 22:45:00 +08:00
|
|
|
m4_define([DIRNAME_TEST],
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
[dir=`AS_DIRNAME([$1])`
|
2001-10-19 07:44:54 +08:00
|
|
|
test "$dir" = "$2" || (test -n "$3" && test "$dir" = "$3") ||
|
2000-11-14 18:40:42 +08:00
|
|
|
echo "dirname($1) = $dir instead of $2" >&2
|
|
|
|
|
2001-10-08 16:21:54 +08:00
|
|
|
if test "$as_expr" != false; then
|
|
|
|
dir=`AS_DIRNAME_EXPR([$1])`
|
2001-10-19 07:44:54 +08:00
|
|
|
test "$dir" = "$2" || (test -n "$3" && test "$dir" = "$3") ||
|
2001-10-08 16:21:54 +08:00
|
|
|
echo "dirname_expr($1) = $dir instead of $2" >&2
|
|
|
|
fi
|
|
|
|
|
2000-11-14 18:40:42 +08:00
|
|
|
dir=`AS_DIRNAME_SED([$1])`
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
test "$dir" = "$2" ||
|
2001-10-19 07:44:54 +08:00
|
|
|
test "$dir" = "$2" || (test -n "$3" && test "$dir" = "$3") ||
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
echo "dirname_sed($1) = $dir instead of $2" >&2])
|
|
|
|
|
2001-09-18 20:26:36 +08:00
|
|
|
DIRNAME_TEST([/], [/])
|
2001-10-19 07:44:54 +08:00
|
|
|
DIRNAME_TEST([//], [//], [/])
|
2001-09-18 20:26:36 +08:00
|
|
|
DIRNAME_TEST([///], [/])
|
2001-10-19 07:44:54 +08:00
|
|
|
DIRNAME_TEST([//1], [//], [/])
|
2001-08-20 22:45:00 +08:00
|
|
|
DIRNAME_TEST([/1], [/])
|
|
|
|
DIRNAME_TEST([./1], [.])
|
|
|
|
DIRNAME_TEST([../../2], [../..])
|
2001-10-19 07:44:54 +08:00
|
|
|
DIRNAME_TEST([//1/], [//], [/])
|
2001-08-20 22:45:00 +08:00
|
|
|
DIRNAME_TEST([/1/], [/])
|
|
|
|
DIRNAME_TEST([./1/], [.])
|
|
|
|
DIRNAME_TEST([../../2], [../..])
|
|
|
|
DIRNAME_TEST([//1/3], [//1])
|
|
|
|
DIRNAME_TEST([/1/3], [/1])
|
|
|
|
DIRNAME_TEST([./1/3], [./1])
|
|
|
|
DIRNAME_TEST([../../2/3], [../../2])
|
|
|
|
DIRNAME_TEST([//1/3///], [//1])
|
|
|
|
DIRNAME_TEST([/1/3///], [/1])
|
|
|
|
DIRNAME_TEST([./1/3///], [./1])
|
|
|
|
DIRNAME_TEST([../../2/3///], [../../2])
|
|
|
|
DIRNAME_TEST([//1//3/], [//1])
|
|
|
|
DIRNAME_TEST([/1//3/], [/1])
|
|
|
|
DIRNAME_TEST([./1//3/], [./1])
|
|
|
|
DIRNAME_TEST([../../2//3/], [../../2])
|
2000-11-02 03:57:54 +08:00
|
|
|
AS_EXIT(0)
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
]])
|
|
|
|
|
2001-10-08 16:21:54 +08:00
|
|
|
AT_CHECK_M4SH
|
2002-01-28 18:46:00 +08:00
|
|
|
AT_CHECK([./script])
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
|
2001-10-08 16:21:54 +08:00
|
|
|
AT_CLEANUP
|
2000-11-10 18:14:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
2001-10-08 16:21:54 +08:00
|
|
|
## ------------- ##
|
|
|
|
## AS_BASENAME. ##
|
|
|
|
## ------------- ##
|
2001-09-18 20:26:36 +08:00
|
|
|
|
|
|
|
# Build nested dirs.
|
2001-10-08 16:21:54 +08:00
|
|
|
AT_SETUP([[AS@&t@_BASENAME]])
|
2001-09-18 20:26:36 +08:00
|
|
|
|
2001-10-08 16:21:54 +08:00
|
|
|
AT_DATA_M4SH([script.as],
|
|
|
|
[[AS_INIT
|
2001-09-18 20:26:36 +08:00
|
|
|
|
|
|
|
m4_define([BASENAME_TEST],
|
|
|
|
[base=`AS_BASENAME([$1])`
|
|
|
|
test "$base" = "$2" ||
|
|
|
|
echo "basename($1) = $base instead of $2" >&2
|
|
|
|
|
|
|
|
base=`AS_BASENAME_SED([$1])`
|
|
|
|
test "$base" = "$2" ||
|
|
|
|
echo "basename_sed($1) = $base instead of $2" >&2])
|
|
|
|
|
|
|
|
BASENAME_TEST([//1], [1])
|
|
|
|
BASENAME_TEST([/1], [1])
|
|
|
|
BASENAME_TEST([./1], [1])
|
|
|
|
BASENAME_TEST([../../2], [2])
|
|
|
|
BASENAME_TEST([//1/], [1])
|
|
|
|
BASENAME_TEST([/1/], [1])
|
|
|
|
BASENAME_TEST([./1/], [1])
|
|
|
|
BASENAME_TEST([../../2], [2])
|
|
|
|
BASENAME_TEST([//1/3], [3])
|
|
|
|
BASENAME_TEST([/1/3], [3])
|
|
|
|
BASENAME_TEST([./1/3], [3])
|
|
|
|
BASENAME_TEST([../../2/3], [3])
|
|
|
|
BASENAME_TEST([//1/3///], [3])
|
|
|
|
BASENAME_TEST([/1/3///], [3])
|
|
|
|
BASENAME_TEST([./1/3///], [3])
|
|
|
|
BASENAME_TEST([../../2/3///], [3])
|
|
|
|
BASENAME_TEST([//1//3/], [3])
|
|
|
|
BASENAME_TEST([/1//3/], [3])
|
|
|
|
BASENAME_TEST([./1//3/], [3])
|
|
|
|
BASENAME_TEST([a.c], [a.c])
|
|
|
|
BASENAME_TEST([a.c/], [a.c])
|
|
|
|
BASENAME_TEST([/a.c/], [a.c])
|
|
|
|
BASENAME_TEST([/1/a.c], [a.c])
|
|
|
|
BASENAME_TEST([/1/a.c/], [a.c])
|
|
|
|
BASENAME_TEST([/1/../a.c], [a.c])
|
|
|
|
BASENAME_TEST([/1/../a.c/], [a.c])
|
|
|
|
BASENAME_TEST([./1/a.c], [a.c])
|
|
|
|
BASENAME_TEST([./1/a.c/], [a.c])
|
|
|
|
AS_EXIT(0)
|
|
|
|
]])
|
|
|
|
|
2001-10-08 16:21:54 +08:00
|
|
|
AT_CHECK_M4SH
|
2002-01-28 18:46:00 +08:00
|
|
|
AT_CHECK([./script])
|
2001-09-18 20:26:36 +08:00
|
|
|
|
2001-10-08 16:21:54 +08:00
|
|
|
AT_CLEANUP
|
2001-09-18 20:26:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
2000-11-10 18:14:44 +08:00
|
|
|
## ------------ ##
|
|
|
|
## AS_MKDIR_P. ##
|
|
|
|
## ------------ ##
|
|
|
|
|
|
|
|
# Build nested dirs.
|
2001-10-08 16:21:54 +08:00
|
|
|
AT_SETUP([[AS@&t@_MKDIR_P]])
|
2000-11-10 18:14:44 +08:00
|
|
|
|
2001-10-08 16:21:54 +08:00
|
|
|
AT_DATA_M4SH([script.as],
|
|
|
|
[[AS_INIT
|
2001-05-31 15:02:13 +08:00
|
|
|
|
2000-11-10 18:14:44 +08:00
|
|
|
pwd=`pwd`
|
|
|
|
set -e
|
|
|
|
# Absolute
|
|
|
|
AS_MKDIR_P(["$pwd/1/2/3/4/5/6"])
|
|
|
|
test -d "$pwd/1/2/3/4/5/6" ||
|
2001-10-08 16:21:54 +08:00
|
|
|
AS_ERROR([$pwd/1/2/3/4/5/6 has not been properly created])
|
2000-11-10 18:14:44 +08:00
|
|
|
# Relative
|
|
|
|
AS_MKDIR_P(["a/b/c/d/e/f"])
|
|
|
|
test -d a/b/c/d/e/f ||
|
2001-10-08 16:21:54 +08:00
|
|
|
AS_ERROR([a/b/c/d/e/f has not been properly created])
|
2000-11-10 18:14:44 +08:00
|
|
|
AS_EXIT(0)
|
|
|
|
]])
|
|
|
|
|
2001-10-08 16:21:54 +08:00
|
|
|
AT_CHECK_M4SH
|
2002-01-28 18:46:00 +08:00
|
|
|
AT_CHECK([./script])
|
2000-11-10 18:14:44 +08:00
|
|
|
|
2002-04-22 18:23:12 +08:00
|
|
|
AT_CLEANUP
|
2000-11-10 22:43:33 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## ----------------------------- ##
|
|
|
|
## Negated classes in globbing. ##
|
|
|
|
## ----------------------------- ##
|
|
|
|
|
|
|
|
# It is known that `[^...]' is not universally supported, but it is
|
|
|
|
# unknown for `[!...]'.
|
|
|
|
|
|
|
|
AT_SETUP([Negated classes in globbing])
|
|
|
|
|
2001-10-08 16:21:54 +08:00
|
|
|
AT_DATA_M4SH([script.as],
|
|
|
|
[[AS_INIT
|
2001-05-31 15:02:13 +08:00
|
|
|
|
2000-11-10 22:43:33 +08:00
|
|
|
case 'with!two!bangs' in
|
|
|
|
*[[!a-z]]*) ;;
|
2001-10-08 16:21:54 +08:00
|
|
|
*) AS_ERROR([[`*[!a-z]*' didn't match `with!two!bangs']]);;
|
2000-11-10 22:43:33 +08:00
|
|
|
esac
|
|
|
|
|
|
|
|
case without in
|
2001-10-08 16:21:54 +08:00
|
|
|
*[[!a-z]]*) AS_ERROR([[`*[!a-z]*' matched `without']]);;
|
2000-11-10 22:43:33 +08:00
|
|
|
esac
|
|
|
|
]])
|
|
|
|
|
2001-10-08 16:21:54 +08:00
|
|
|
AT_CHECK_M4SH
|
2002-01-28 18:46:00 +08:00
|
|
|
AT_CHECK([./script])
|
2000-11-10 22:43:33 +08:00
|
|
|
|
2001-08-20 22:45:00 +08:00
|
|
|
AT_CLEANUP
|
2002-09-28 22:10:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## ------------------- ##
|
|
|
|
## Functions Support. ##
|
|
|
|
## ------------------- ##
|
|
|
|
|
|
|
|
# Hypothesis: the shell we are running, after having checked for
|
|
|
|
# $LINENO support, supports functions.
|
|
|
|
|
|
|
|
AT_SETUP([Functions Support])
|
|
|
|
|
|
|
|
AT_DATA_M4SH([script.as],
|
|
|
|
[[AS_INIT
|
|
|
|
_AS_LINENO_PREPARE
|
|
|
|
|
|
|
|
func_return () {
|
|
|
|
(exit $1)
|
|
|
|
}
|
|
|
|
|
|
|
|
func_success () {
|
|
|
|
func_return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func_failure () {
|
|
|
|
func_return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
if func_success; then
|
|
|
|
if func_failure; then
|
|
|
|
AS_ERROR([func_failure passed])
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
AS_ERROR([func_success failed])
|
|
|
|
fi
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_M4SH
|
|
|
|
AT_CHECK([./script])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## ------------------------------ ##
|
|
|
|
## Functions and return Support. ##
|
|
|
|
## ------------------------------ ##
|
|
|
|
|
|
|
|
# Hypothesis: the shell we are running, after having checked for
|
|
|
|
# $LINENO support, supports functions, and the `return' keyword.
|
|
|
|
|
|
|
|
AT_SETUP([Functions and return Support])
|
|
|
|
|
|
|
|
AT_DATA_M4SH([script.as],
|
|
|
|
[[AS_INIT
|
|
|
|
_AS_LINENO_PREPARE
|
|
|
|
|
|
|
|
func_success () {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func_failure () {
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
if func_success; then
|
|
|
|
if func_failure; then
|
|
|
|
AS_ERROR([func_failure passed])
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
AS_ERROR([func_success failed])
|
|
|
|
fi
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_M4SH
|
|
|
|
AT_CHECK([./script])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
2003-03-27 21:18:34 +08:00
|
|
|
|
2003-11-24 18:44:52 +08:00
|
|
|
|
|
|
|
## ------------------------------------ ##
|
|
|
|
## AS_REQUIRE_SHELL_FN and m4_require. ##
|
|
|
|
## ------------------------------------ ##
|
|
|
|
|
|
|
|
# Hypothesis: M4sh expands the requirements of AS_REQUIRE_SHELL_FN
|
|
|
|
# in the main diversion, and not in M4SH-INIT.
|
|
|
|
|
|
|
|
AT_SETUP([AS@&t@_REQUIRE_SHELL_FN and m4@&t@_require])
|
|
|
|
|
|
|
|
AT_DATA_M4SH([script.as], [[dnl
|
|
|
|
AS_INIT
|
|
|
|
|
|
|
|
m4_defun([in_m4_sh_init], still_in_m4sh_init=yes)
|
|
|
|
m4_defun([not_in_m4_sh_init], still_in_m4sh_init=no)
|
|
|
|
|
|
|
|
m4_defun([error_if_emitted_in_m4sh_init], [
|
|
|
|
if test x$still_in_m4sh_init = xyes; then
|
|
|
|
AS_ERROR([requirement emitted in M4SH-INIT])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
m4_defun([TEST_FUNC_BODY], [
|
|
|
|
m4_require([error_if_emitted_in_m4sh_init])
|
|
|
|
: echo in shell function, with parameter = [$]1
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
m4_defun([test_init], [
|
|
|
|
AS_REQUIRE([in_m4_sh_init])
|
|
|
|
AS_REQUIRE_SHELL_FN([test_func], [TEST_FUNC_BODY])
|
|
|
|
AS_REQUIRE([not_in_m4_sh_init])
|
|
|
|
])
|
|
|
|
|
|
|
|
test_init
|
|
|
|
test_func parameter1
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_M4SH
|
|
|
|
AT_CHECK([./script])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
2003-03-27 21:18:34 +08:00
|
|
|
## -------------- ##
|
|
|
|
## AS_HELP_STRING ##
|
|
|
|
## -------------- ##
|
|
|
|
|
|
|
|
# I'm not totally certain that we want to enforce the defaults here,
|
|
|
|
# but at least it is being tested.
|
|
|
|
|
|
|
|
AT_SETUP([[AS@&t@_HELP_STRING]])
|
|
|
|
|
|
|
|
AT_DATA_M4SH([script.as],
|
|
|
|
[[AS_INIT
|
|
|
|
_AS_LINENO_PREPARE
|
|
|
|
|
|
|
|
echo "AS_HELP_STRING([--an-option],[some text])"
|
|
|
|
echo "AS_HELP_STRING([--another-much-longer-option],
|
|
|
|
[some other text which should wrap at our default of 80 characters.])"
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_M4SH
|
|
|
|
AT_CHECK([./script], [0],
|
|
|
|
[ --an-option some text
|
|
|
|
--another-much-longer-option
|
|
|
|
some other text which should wrap at our default of
|
|
|
|
80 characters.
|
|
|
|
])
|
|
|
|
|
|
|
|
AT_CLEANUP
|