autoconf/tests/m4sh.at
Akim Demaille 0b057944a7 * bin/autom4te.in (&handle_output): s/@__@/@&t@/.
Suggested by Paul Eggert.
2001-08-29 13:11:16 +00:00

138 lines
3.1 KiB
Plaintext

# -*- Autotest -*-
AT_BANNER([M4sh.])
# Copyright 2000, 2001 Free Software Foundation, Inc.
#
# 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.
# Used in many tests.
m4_pattern_allow([^AS_EXIT$])
## ----------------------------- ##
## AS_DIRNAME & AS_DIRNAME_SED. ##
## ----------------------------- ##
# Build nested dirs.
m4_pattern_allow([^AS_DIRNAME(_SED)?$])
AT_SETUP([[AS_DIRNAME & AS_DIRNAME_SED]])
AT_DATA([configure.ac],
[[AC_PLAIN_SCRIPT()
#! /bin/sh
_AS@&t@_EXPR_PREPARE
m4_define([DIRNAME_TEST],
[dir=`AS_DIRNAME([$1])`
test "$dir" = "$2" ||
echo "dirname($1) = $dir instead of $2" >&2
dir=`AS_DIRNAME_SED([$1])`
test "$dir" = "$2" ||
echo "dirname_sed($1) = $dir instead of $2" >&2])
DIRNAME_TEST([//1], [//])
DIRNAME_TEST([/1], [/])
DIRNAME_TEST([./1], [.])
DIRNAME_TEST([../../2], [../..])
DIRNAME_TEST([//1/], [//])
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])
AS_EXIT(0)
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE
AT_CLEANUP(configure)
## ------------ ##
## AS_MKDIR_P. ##
## ------------ ##
# Build nested dirs.
m4_pattern_allow([^AS_MKDIR_P$])
AT_SETUP([[AS_MKDIR_P]])
AT_DATA([configure.ac],
[[AC_PLAIN_SCRIPT()
#! /bin/sh
pwd=`pwd`
set -e
# Absolute
AS_MKDIR_P(["$pwd/1/2/3/4/5/6"])
test -d "$pwd/1/2/3/4/5/6" ||
AC_MSG_ERROR([$pwd/1/2/3/4/5/6 has not been properly created])
# Relative
AS_MKDIR_P(["a/b/c/d/e/f"])
test -d a/b/c/d/e/f ||
AC_MSG_ERROR([a/b/c/d/e/f has not been properly created])
AS_EXIT(0)
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE
AT_CLEANUP(configure 1 a)
## ----------------------------- ##
## Negated classes in globbing. ##
## ----------------------------- ##
# It is known that `[^...]' is not universally supported, but it is
# unknown for `[!...]'.
AT_SETUP([Negated classes in globbing])
AT_DATA([configure.ac],
[[AC_PLAIN_SCRIPT()
#! /bin/sh
case 'with!two!bangs' in
*[[!a-z]]*) ;;
*) AC_MSG_ERROR([[`*[!a-z]*' didn't match `with!two!bangs']]);;
esac
case without in
*[[!a-z]]*) AC_MSG_ERROR([[`*[!a-z]*' matched `without']]);;
esac
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE
AT_CLEANUP