Debian Codegraph @

tests/m4sh.at

raw
1 # -*- Autoconf -*-
2
3 AT_BANNER([M4sh.])
4
5
6 ## ----------------------------- ##
7 ## AS_DIRNAME & AS_DIRNAME_SED. ##
8 ## ----------------------------- ##
9
10 # Build nested dirs.
11
12 AT_SETUP([[AS_DIRNAME & AS_DIRNAME_SED]])
13
14 AT_DATA(configure.ac,
15 [[AC_PLAIN_SCRIPT()dnl
16 #! /bin/sh
17
18 _AS_EXPR_PREPARE
19
20 define([AS_DIRNAME_TEST],
21 [dir=`AS_DIRNAME([$1])`
22 test "$dir" = "$2" ||
23 echo "dirname($1) = $dir instead of $2" >&2
24
25 dir=`AS_DIRNAME_SED([$1])`
26 test "$dir" = "$2" ||
27 echo "dirname_sed($1) = $dir instead of $2" >&2])
28
29 AS_DIRNAME_TEST([//1], [//])
30 AS_DIRNAME_TEST([/1], [/])
31 AS_DIRNAME_TEST([./1], [.])
32 AS_DIRNAME_TEST([../../2], [../..])
33 AS_DIRNAME_TEST([//1/], [//])
34 AS_DIRNAME_TEST([/1/], [/])
35 AS_DIRNAME_TEST([./1/], [.])
36 AS_DIRNAME_TEST([../../2], [../..])
37 AS_DIRNAME_TEST([//1/3], [//1])
38 AS_DIRNAME_TEST([/1/3], [/1])
39 AS_DIRNAME_TEST([./1/3], [./1])
40 AS_DIRNAME_TEST([../../2/3], [../../2])
41 AS_DIRNAME_TEST([//1/3///], [//1])
42 AS_DIRNAME_TEST([/1/3///], [/1])
43 AS_DIRNAME_TEST([./1/3///], [./1])
44 AS_DIRNAME_TEST([../../2/3///], [../../2])
45 AS_DIRNAME_TEST([//1//3/], [//1])
46 AS_DIRNAME_TEST([/1//3/], [/1])
47 AS_DIRNAME_TEST([./1//3/], [./1])
48 AS_DIRNAME_TEST([../../2//3/], [../../2])
49 AS_EXIT(0)
50 ]])
51
52 AT_CHECK_AUTOCONF
53 AT_CHECK_CONFIGURE
54
55 AT_CLEANUP(configure)
56
57
58
59 ## ------------ ##
60 ## AS_MKDIR_P. ##
61 ## ------------ ##
62
63 # Build nested dirs.
64
65 AT_SETUP([[AS_MKDIR_P]])
66
67 AT_DATA([configure.ac],
68 [[AC_PLAIN_SCRIPT()dnl
69 #! /bin/sh
70
71 pwd=`pwd`
72 set -e
73 # Absolute
74 AS_MKDIR_P(["$pwd/1/2/3/4/5/6"])
75 test -d "$pwd/1/2/3/4/5/6" ||
76 AC_MSG_ERROR([$pwd/1/2/3/4/5/6 has not been properly created])
77 # Relative
78 AS_MKDIR_P(["a/b/c/d/e/f"])
79 test -d a/b/c/d/e/f ||
80 AC_MSG_ERROR([a/b/c/d/e/f has not been properly created])
81 AS_EXIT(0)
82 ]])
83
84 AT_CHECK_AUTOCONF
85 AT_CHECK_CONFIGURE
86
87 AT_CLEANUP(configure 1 a)
88
89
90
91
92 ## ----------------------------- ##
93 ## Negated classes in globbing. ##
94 ## ----------------------------- ##
95
96 # It is known that `[^...]' is not universally supported, but it is
97 # unknown for `[!...]'.
98
99 AT_SETUP([Negated classes in globbing])
100
101 AT_DATA([configure.ac],
102 [[AC_PLAIN_SCRIPT()dnl
103 #! /bin/sh
104
105 case 'with!two!bangs' in
106 *[[!a-z]]*) ;;
107 *) AC_MSG_ERROR([[`*[!a-z]*' didn't match `with!two!bangs']]);;
108 esac
109
110 case without in
111 *[[!a-z]]*) AC_MSG_ERROR([[`*[!a-z]*' matched `without']]);;
112 esac
113 ]])
114
115 AT_CHECK_AUTOCONF
116 AT_CHECK_CONFIGURE
117
118 AT_CLEANUP(configure)