summaryrefslogtreecommitdiffstats
path: root/tests/m4sh.at
blob: 255c185f0ff31abc6283a5a0037084f665f33a62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
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)