summaryrefslogtreecommitdiffstats
path: root/tests/m4sh.at
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 19:28:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 19:28:49 +0000
commit9f9b6e7b09a54b2c8089de33c975086104956249 (patch)
tree29445e7621f24b9ff64b2ea59a434ef0985a143e /tests/m4sh.at
parentInitial commit. (diff)
downloadautoconf-dickey-9f9b6e7b09a54b2c8089de33c975086104956249.tar.xz
autoconf-dickey-9f9b6e7b09a54b2c8089de33c975086104956249.zip
Adding upstream version 2.52+20231210.upstream/2.52+20231210
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/m4sh.at')
-rw-r--r--tests/m4sh.at118
1 files changed, 118 insertions, 0 deletions
diff --git a/tests/m4sh.at b/tests/m4sh.at
new file mode 100644
index 0000000..255c185
--- /dev/null
+++ b/tests/m4sh.at
@@ -0,0 +1,118 @@
+# -*- Autoconf -*-
+
+AT_BANNER([M4sh.])
+
+
+## ----------------------------- ##
+## AS_DIRNAME & AS_DIRNAME_SED. ##
+## ----------------------------- ##
+
+# Build nested dirs.
+
+AT_SETUP([[AS_DIRNAME & AS_DIRNAME_SED]])
+
+AT_DATA(configure.ac,
+[[AC_PLAIN_SCRIPT()dnl
+#! /bin/sh
+
+_AS_EXPR_PREPARE
+
+define([AS_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])
+
+AS_DIRNAME_TEST([//1], [//])
+AS_DIRNAME_TEST([/1], [/])
+AS_DIRNAME_TEST([./1], [.])
+AS_DIRNAME_TEST([../../2], [../..])
+AS_DIRNAME_TEST([//1/], [//])
+AS_DIRNAME_TEST([/1/], [/])
+AS_DIRNAME_TEST([./1/], [.])
+AS_DIRNAME_TEST([../../2], [../..])
+AS_DIRNAME_TEST([//1/3], [//1])
+AS_DIRNAME_TEST([/1/3], [/1])
+AS_DIRNAME_TEST([./1/3], [./1])
+AS_DIRNAME_TEST([../../2/3], [../../2])
+AS_DIRNAME_TEST([//1/3///], [//1])
+AS_DIRNAME_TEST([/1/3///], [/1])
+AS_DIRNAME_TEST([./1/3///], [./1])
+AS_DIRNAME_TEST([../../2/3///], [../../2])
+AS_DIRNAME_TEST([//1//3/], [//1])
+AS_DIRNAME_TEST([/1//3/], [/1])
+AS_DIRNAME_TEST([./1//3/], [./1])
+AS_DIRNAME_TEST([../../2//3/], [../../2])
+AS_EXIT(0)
+]])
+
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE
+
+AT_CLEANUP(configure)
+
+
+
+## ------------ ##
+## AS_MKDIR_P. ##
+## ------------ ##
+
+# Build nested dirs.
+
+AT_SETUP([[AS_MKDIR_P]])
+
+AT_DATA([configure.ac],
+[[AC_PLAIN_SCRIPT()dnl
+#! /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()dnl
+#! /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(configure)