Lines Matching defs:err_exit

20 function err_exit
26 alias err_exit='err_exit $LINENO'
31 tmp=$(mktemp -dt) || { err_exit mktemp -dt failed; exit 1; }
36 then err_exit "-z: null string should be of zero length"
41 then err_exit "-z: $file string should not be of zero length"
44 then err_exit "-a: $file shouldn't exist"
48 then err_exit "-a: $file should exist"
52 then err_exit "-r: $file should be readable"
55 then err_exit "-w: $file should be writable"
58 then err_exit "-x: $file should be executable"
61 then err_exit "-rw: $file should be readable/writable"
64 then err_exit "-s: $file should be of zero size"
67 then err_exit "-f: $file should be an ordinary file"
70 then err_exit "-f: $file should not be a directory file"
73 then err_exit "-d: . should not be a directory file"
76 then err_exit "-f: /dev/null should not be an ordinary file"
80 then err_exit "-r: $file should not be readable"
83 then err_exit "-r: $file should be owned by me"
86 then err_exit "-w: $file should not be writable"
89 then err_exit "-x: $file should not be executable"
92 then err_exit "-rw: $file should not be readable/writable"
96 else err_exit " wrong precedence"
99 then err_exit " () grouping not working"
102 then err_exit "foo comes before bar"
104 [[ . -ef $(pwd) ]] || err_exit ". is not $PWD"
106 [[ -o allexport ]] || err_exit '-o: did not set allexport option'
108 then err_exit "'$null' has non-zero length"
111 then err_exit "/dev/fd/0 not open for reading"
114 then err_exit "/dev/fd/2 not open for writing"
119 then err_exit "$file should be older than $newer_file"
122 then err_exit "$newer_file should be newer than $file"
125 then err_exit "$file should match $tmp/*"
128 then err_exit "$file should not equal $tmp'/*'"
130 [[ ! ( ! -z $null && ! -z x) ]] || err_exit "negation and grouping"
131 [[ -z '' || -z '' || -z '' ]] || err_exit "three ors not working"
132 [[ -z '' && -z '' && -z '' ]] || err_exit "three ors not working"
135 then err_exit 'value $? within [[...]]'
139 then err_exit " '(x' does not match '('* within [[...]]"
142 then err_exit ' "(x" does not match "("* within [[...]]'
145 then err_exit ' "(x" does not match \(* within [[...]]'
148 then err_exit " 'x(' does not match '('* within [[...]]"
151 then err_exit " 'x&' does not match '&'* within [[...]]"
154 then err_exit " 'xy' matches *'*' within [[...]]"
157 then err_exit '3 < 4'
160 then err_exit '3 > 4'
163 then err_exit '3x < 4x'
168 then err_exit 'extended pattern matching on command arguments'
171 then err_exit 'extended pattern matching not working on variables'
174 then err_exit "setuid on $SHELL"
177 then err_exit "setgid on $SHELL"
179 test -d . -a '(' ! -f . ')' || err_exit 'test not working'
181 then err_exit 'quoting unary operator not working'
183 test \( -n x \) -o \( -n y \) 2> /dev/null || err_exit 'test ( -n x ) -o ( -n y) not working'
184 test \( -n x \) -o -n y 2> /dev/null || err_exit 'test ( -n x ) -o -n y not working'
189 then err_exit "-s: $file should be non-zero"
193 then err_exit "leading zeros in arithmetic compares not ignored"
198 } 2> /dev/null || { set +x; err_exit "foo<bar with -x enabled" ;}
202 ) 2> /dev/null || err_exit "[[ (a) ]] not working"
206 then err_exit "test ! -u suidfile not working"
209 do [[ $i == $i ]] || err_exit "[[ $i != $i ]]"
212 [[ aaaa == {4}(a) ]] || err_exit 'aaaa != {4}(a)'
213 [[ aaaa == {2,5}(a) ]] || err_exit 'aaaa != {2,4}(a)'
214 [[ abcdcdabcd == {3,6}(ab|cd) ]] || err_exit 'abcdcdabcd == {3,4}(ab|cd)'
215 [[ abcdcdabcde == {5}(ab|cd)e ]] || err_exit 'abcdcdabcd == {5}(ab|cd)e'
216 ) || err_exit 'errors with {..}(...) patterns'
217 [[ D290.2003.02.16.temp == D290.+(2003.02.16).temp* ]] || err_exit 'pattern match bug with +(...)'
220 [[ -N $file ]] && err_exit 'test -N $tmp/*: st_mtime>st_atime after creat'
223 [[ -N $file ]] || err_exit 'test -N $tmp/*: st_mtime<=st_atime after write'
226 [[ -N $file ]] && err_exit 'test -N $tmp/*: st_mtime>st_atime after read'
229 then [[ -L "$file" ]] || err_exit '-L not working'
230 [[ -L "$file"/ ]] && err_exit '-L with file/ not working'
232 $SHELL -c 't=1234567890; [[ $t == @({10}(\d)) ]]' 2> /dev/null || err_exit ' @({10}(\d)) pattern not working'
233 $SHELL -c '[[ att_ == ~(E)(att|cus)_.* ]]' 2> /dev/null || err_exit ' ~(E)(att|cus)_* pattern not working'
234 $SHELL -c '[[ att_ =~ (att|cus)_.* ]]' 2> /dev/null || err_exit ' =~ ere not working'
235 $SHELL -c '[[ abc =~ a(b)c ]]' 2> /dev/null || err_exit '[[ abc =~ a(b)c ]] fails'
236 $SHELL -xc '[[ abc =~ \babc\b ]]' 2> /dev/null || err_exit '[[ abc =~ \babc\b ]] fails'
237 [[ abc == ~(E)\babc\b ]] || err_exit '\b not preserved for ere when not in ()'
238 [[ abc == ~(iEi)\babc\b ]] || err_exit '\b not preserved for ~(iEi) when not in ()'
241 [[ $e ]] && err_exit "[ ... ] compatibility check failed -- $e"
243 [[ hell0 == $i[0] ]] || err_exit 'pattern $i[0] interpreded as array ref'
244 test '(' = ')' && err_exit '"test ( = )" should not be true'
245 [[ $($SHELL -c 'case F in ~(Eilr)[a-z0-9#]) print ok;;esac' 2> /dev/null) == ok ]] || err_exit '~(Eilr) not working in case command'
246 [[ $($SHELL -c "case Q in ~(Fi)q | \$'\E') print ok;;esac" 2> /dev/null) == ok ]] || err_exit '~(Fi)q | \E not working in case command'
284 [[ $g == $e ]] || err_exit "[[ '$c' == $p ]] for LC_COLLATE=$l failed -- expected $e, got $g"
290 then [[ -t $n ]] || err_exit "[[ -t n ]] fails when n > 9"
293 [[ -v foo[1] ]] || err_exit 'foo[1] should be set'
294 [[ ${foo[1]+x} ]] || err_exit '${foo[1]+x} should be x'
295 [[ ${foo[@]+x} ]] || err_exit '${foo[@]+x} should be x'
297 [[ -v foo[1] ]] && err_exit 'foo[1] should not be set'
298 [[ ${foo[1]+x} ]] && err_exit '${foo[1]+x} should be empty'
300 [[ -v bar[1] ]] || err_exit 'bar[1] should be set'
301 [[ ${bar[1]+x} ]] || err_exit '${foo[1]+x} should be x'
303 [[ ${bar[1]+x} ]] && err_exit '${foo[1]+x} should be empty'
304 [[ -v bar ]] || err_exit 'bar should be set'
305 [[ -v bar[1] ]] && err_exit 'bar[1] should not be set'
307 [[ -v z[1] ]] || err_exit 'z[1] should be set'
309 [[ -v z[1] ]] && err_exit 'z[1] should not be set'
311 [[ -v y[6] ]] && err_exit 'y[6] should not be set'
312 [[ -v y[1] ]] || err_exit 'y[1] should be set'
314 [[ -v y[1] ]] && err_exit 'y[1] should not be set'
316 [[ -v x[0] ]] || err_exit 'x[0] should be set'
317 [[ ${x[0]+x} ]] || err_exit print '${x[0]+x} should be x'
318 [[ -v x[3] ]] && err_exit 'x[3] should not be set'
319 [[ ${x[3]+x} ]] && err_exit '${x[0]+x} should be Empty'
321 [[ ${x[@]+x} ]] && err_exit '${x[@]+x} should be Empty'