eglob.t revision 1.1
1name: eglob-bad-1
2description:
3	Check that globbing isn't done when glob has syntax error
4file-setup: file 644 "abcx"
5file-setup: file 644 "abcz"
6file-setup: file 644 "bbc"
7stdin:
8	echo !([*)*
9	echo +(a|b[)*
10expected-stdout:
11	!([*)*
12	+(a|b[)*
13---
14
15name: eglob-bad-2
16description:
17	Check that globbing isn't done when glob has syntax error
18	(at&t ksh fails this test)
19file-setup: file 644 "abcx"
20file-setup: file 644 "abcz"
21file-setup: file 644 "bbc"
22stdin:
23	echo [a*(]*)z
24expected-stdout:
25	[a*(]*)z
26---
27
28name: eglob-infinite-plus
29description:
30	Check that shell doesn't go into infinite loop expanding +(...)
31	expressions.
32file-setup: file 644 "abc"
33time-limit: 3
34stdin:
35	echo +()c
36	echo +()x
37	echo +(*)c
38	echo +(*)x
39expected-stdout:
40	+()c
41	+()x
42	abc
43	+(*)x
44---
45
46name: eglob-subst-1
47description:
48	Check that eglobbing isn't done on substitution results
49file-setup: file 644 "abc"
50stdin:
51	x='@(*)'
52	echo $x
53expected-stdout:
54	@(*)
55---
56
57name: eglob-nomatch-1
58description:
59	Check that the pattern doesn't match
60stdin:
61	echo 1: no-file+(a|b)stuff
62	echo 2: no-file+(a*(c)|b)stuff
63	echo 3: no-file+((((c)))|b)stuff
64expected-stdout:
65	1: no-file+(a|b)stuff
66	2: no-file+(a*(c)|b)stuff
67	3: no-file+((((c)))|b)stuff
68---
69
70name: eglob-match-1
71description:
72	Check that the pattern matches correctly
73file-setup: file 644 "abd"
74file-setup: file 644 "acd"
75file-setup: file 644 "abac"
76stdin:
77	echo 1: a+(b|c)d
78	echo 2: a!(@(b|B))d
79	echo 3: *(a(b|c))		# (...|...) can be used within X(..)
80	echo 4: a[b*(foo|bar)]d		# patterns not special inside [...]
81expected-stdout:
82	1: abd acd
83	2: acd
84	3: abac
85	4: abd
86---
87
88name: eglob-case-1
89description:
90	Simple negation tests
91stdin:
92	case foo in !(foo|bar)) echo yes;; *) echo no;; esac
93	case bar in !(foo|bar)) echo yes;; *) echo no;; esac
94expected-stdout:
95	no
96	no
97---
98
99name: eglob-case-2
100description:
101	Simple kleene tests
102stdin:
103	case foo in *(a|b[)) echo yes;; *) echo no;; esac
104	case foo in *(a|b[)|f*) echo yes;; *) echo no;; esac
105	case '*(a|b[)' in *(a|b[)) echo yes;; *) echo no;; esac
106expected-stdout:
107	no
108	yes
109	yes
110---
111
112name: eglob-trim-1
113description:
114	Eglobing in trim expressions...
115	(at&t ksh fails this - docs say # matches shortest string, ## matches
116	longest...)
117stdin:
118	x=abcdef
119	echo 1: ${x#a|abc}
120	echo 2: ${x##a|abc}
121	echo 3: ${x%def|f}
122	echo 4: ${x%%f|def}
123expected-stdout:
124	1: bcdef
125	2: def
126	3: abcde
127	4: abc
128---
129
130name: eglob-trim-2
131description:
132	Check eglobing works in trims...
133stdin:
134	x=abcdef
135	echo 1: ${x#*(a|b)cd}
136	echo 2: "${x#*(a|b)cd}"
137	echo 3: ${x#"*(a|b)cd"}
138	echo 4: ${x#a(b|c)}
139expected-stdout:
140	1: ef
141	2: ef
142	3: abcdef
143	4: cdef
144---
145
146