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; }
45 then err_exit '$x is not element 0'
48 then err_exit '${x[0] is not element 0'
51 then err_exit "length of ${x[0]} is not 4"
54 then err_exit 'number of elements of x is not 6'
57 then err_exit ' element two is not 2'
60 then err_exit ' ${x[@]:2:1} is not two'
64 then err_exit '$x is not element 0'
67 then err_exit '${y[0] is not element 0'
70 then err_exit 'number of elements of y is not 7'
73 then err_exit ' element two is not 2'
77 then err_exit ' element two is not 2'
80 then err_exit '${y[0] is not nine'
84 then err_exit 'number of elements of y is not 6'
87 then err_exit 'string length of unset element is not 0'
91 then err_exit 'number of elements of unset variable foo is not 0'
95 then err_exit 'string length of null element is not 0'
98 then err_exit 'number of elements of null variable foo is not 1'
106 then err_exit 'number of elements of left in variable foo is not 0'
114 then err_exit 'number of elements of left in variable foo again is not 0'
118 then err_exit 'number of elements of left in variable xxx is not 2'
122 then err_exit 'number of elements of left in variable xxx again is not 2'
126 then err_exit 'number of elements of foo is not 6'
129 then err_exit 'number of elements of PWD is not 1'
134 then err_exit 'number of elements of x is not 2'
138 then err_exit 'c[1]=foo s[1]=1; ${c[s[1]]} != foo'
146 then err_exit 'number of elements of is not 2'
150 then err_exit '[[ ${s[$z]} != 3 ]]'
153 then err_exit '(( s[$z] != 3 ))'
157 then err_exit '[[ ${s[$y]} != 4 ]]'
160 then err_exit '(( s[$y] != 4 ))'
168 then err_exit 'error in array conversion from int to R12'
171 then err_exit 'error in count of array conversion from int to R12'
175 set | grep '^abcdefg$' >/dev/null && err_exit 'empty array variable in set list'
180 then err_exit 'arithmetic expressions in typeset not working'
186 then err_exit 'initial value not preserved when typecast to associative'
193 then err_exit 'conversion of indexed to associative array failed'
197 then err_exit '${#} not 13'
202 then err_exit '${!xxx[@]} for scalar not 0'
205 then err_exit '${11} not working'
208 then err_exit '${@:4:1} not working'
213 then err_exit '${!foovar@} does not expand correctly'
216 then err_exit '${!foovar1} != foovar1'
221 then err_exit '${!xxx[@]} should be null'
230 then err_exit 'execution trace side effects with array subscripts'
235 then err_exit '$(set -A list ...) leaves side effects'
241 then err_exit 'array not restored after subshell'
246 then err_exit '${xpath[@]##*/} not applied to each element'
251 then err_exit 'array offset of -1 not working'
254 then err_exit 'array offset of -3:1 not working'
256 $SHELL -c 'x=(if then else fi)' 2> /dev/null || err_exit 'reserved words in x=() assignment not working'
261 then err_exit 'array getting unset before right hand side evaluation'
267 then err_exit 'exporting indexed array not exporting 0-th element'
276 err_exit 'exporting associative array not exporting 0-th element'
279 foo[$((10))]=ok 2> /dev/null || err_exit 'arithmetic expression as subscript not working'
283 [[ $foo == 0 ]] || err_exit 'zero element of associative array not being set'
290 then err_exit 'error in subscript names'
295 [[ ${x[1]} == 2 ]] || err_exit 'index array produce side effects in subshells'
299 [[ ${#x[@]} == 4 ]] || err_exit 'index array append in subshell error'
301 [[ ${#x[@]} == 3 ]] || err_exit 'index array append in subshell effects parent'
304 [[ ${x[two]} == 2 ]] || err_exit 'associative array produce side effects in subshells'
309 [[ ${#x[@]} == 4 ]] || err_exit 'associative array append in subshell error'
311 [[ ${#x[@]} == 3 ]] || err_exit 'associative array append in subshell effects parent'
317 [[ ${#x[@]} == 40 ]] || err_exit 'index arrays loosing values'
318 [[ $( ($SHELL -c 'typeset -A var; (IFS=: ; set -A var a:b:c ;print ${var[@]});:' )2>/dev/null) == 'a b c' ]] || err_exit 'change associative to index failed'
323 done) == ok ]] || err_exit 'invalid optimization for subscripted variables'
327 ) 2> /dev/null && err_exit 'set +A with associative array should be an error'
333 [[ $bam == value ]] && err_exit 'unset associative array element error'
338 [[ $($SHELL -c "var=(foo bar);export var;$tmp/script") == foo ]] || err_exit 'export array not exporting just first element'
345 [[ $foo == three ]] || err_exit '--allexport not working with arrays'
353 [[ $($SHELL -c "typeset -A foo;$tmp/script") == foo ]] 2> /dev/null || err_exit 'empty associative arrays not being cleared correctly before scripts'
354 [[ $($SHELL -c "typeset -A foo;foo[abc]=abc;$tmp/script") == foo ]] 2> /dev/null || err_exit 'associative arrays not being cleared correctly before scripts'
357 [[ ${foo[@]:1} == two ]] || err_exit '${foo[@]:1} == two'
358 [[ ! ${foo[@]:2} ]] || err_exit '${foo[@]:2} not null'
361 [[ ! ${foo[@]:1} ]] || err_exit '${foo[@]:1} not null'
375 [[ $(typeset | grep foo$) == *associative* ]] || err_exit 'array lost associative attribute'
376 [[ ! ${foo[@]} ]] || err_exit 'array not empty'
377 [[ ! ${!foo[@]} ]] || err_exit 'array names not empty'
381 (( $# == 0 )) || err_exit '${foo[@]:1} should not have any values'
385 (( bar == 4 )) || err_exit "subscript of unset variable not evaluated -- expected '4', got '$got'"
388 (( bar == $exp )) || err_exit "subscript of unset variable not evaluated -- expected '$exp', got '$got'"
395 [[ ${!foo[2+2]} == 'foo[4]' ]] || err_exit '${!var[sub]} should be var[sub]'
396 [[ ${bar[${foo[5]}]} == 3 ]] || err_exit 'array subscript cannot be an array instance'
397 [[ $bar[4] == 3 ]] || err_exit '$bar[x] != ${bar[x]} inside [[ ]]'
398 (( $bar[4] == 3 )) || err_exit '$bar[x] != ${bar[x]} inside (( ))'
399 [[ $bar[$foo[5]] == 3 ]] || err_exit '$bar[foo[x]] != ${bar[foo[x]]} inside [[ ]]'
400 (( $bar[$foo[5]] == 3 )) || err_exit '$bar[foo[x]] != ${bar[foo[x]]} inside (( ))'
402 [[ $x == 4 ]] && err_exit '$bar[4] should not be an array in an assignment'
404 (( $x == 3 )) || err_exit '${bar[$foo[sub]]} not working'
418 ) == val=4 ]] 2> /dev/null || err_exit 'after reading array[j] and assign array[j] fails'
424 ) == name ]] 2> /dev/null || err_exit 'indexed array in compound variable not working'
427 [[ $bar == 2 ]] || err_exit 'subscript not evaluated for unset variable'
431 [[ $foo[bar] == ok ]] || err_exit 'typeset -a not working for simple assignment'
434 [[ $(typeset | grep 'foo$') == *index* ]] || err_exit 'typeset -a not creating an indexed array'
436 [[ $(typeset | grep 'foo$') == *index* ]] || err_exit 'append to indexed array not preserving array type'
439 [[ $foo[bar] == ok ]] && err_exit 'typeset -A not working for simple assignment'
442 [[ ${foo[bar].x} == ok ]] && err_exit 'typeset -A not working for compound assignment'
443 [[ $($SHELL -c 'typeset -a foo;typeset | grep "foo$"' 2> /dev/null) == *index* ]] || err_exit 'typeset fails for indexed array with no elements'
445 [[ $(typeset | grep xxxxx$) == *'indexed array'* ]] || err_exit 'array of one element not an indexed array'
448 { [[ ${!foo[1].*} == 'foo[1].x foo[1].y' ]] ;} 2> /dev/null || err_exit '${!foo[sub].*} not expanding correctly'
451 [[ ${@x.foo} == 'typeset -a'* ]] || err_exit 'x.foo is not an indexed array'
453 [[ ${@x.foo} == 'typeset -A'* ]] || err_exit 'x.foo is not an associative array'
454 $SHELL -c $'x=(foo\n\tbar\nbam\n)' 2> /dev/null || err_exit 'compound array assignment with new-lines not working'
455 $SHELL -c $'x=(foo\n\tbar:\nbam\n)' 2> /dev/null || err_exit 'compound array assignment with labels not working'
456 $SHELL -c $'x=(foo\n\tdone\nbam\n)' 2> /dev/null || err_exit 'compound array assignment with reserved words not working'
457 [[ $($SHELL -c 'typeset -A A; print $(( A[foo].bar ))' 2> /dev/null) == 0 ]] || err_exit 'unset variable not evaluating to 0'
463 [[ ${!a[@]} == z ]] || err_exit '"unset a[a]" unsets entire array'
468 [[ ${a[*]} == "${b[*]}" ]] || err_exit 'printf %B not preserving values for arrays'
469 [[ ${a[*]} == "${c[*]}" ]] || err_exit 'printf %#B not preserving values for arrays'
473 [[ ${a[-1]} == six ]] || err_exit 'a[-1] should be six'
474 [[ ${a[-3]} == four ]] || err_exit 'a[-3] should be four'
475 [[ ${a[-3..-1]} == 'four six' ]] || err_exit "a[-3,-1] should be 'four six'"
480 [[ ${#FILTER[@]} == 2 ]] || err_exit "FILTER array should have two elements not ${#FILTER[@]}"
489 [[ $z == sub=1 ]] || err_exit 'get function not invoked for index array'
499 [[ $z == sub=1 ]] || err_exit 'get function not invoked for associative array'