Lines Matching refs:foo

89 unset foo
90 if (( ${#foo[@]} != 0 ))
91 then err_exit 'number of elements of unset variable foo is not 0'
93 foo=''
94 if (( ${#foo[0]} != 0 ))
97 if (( ${#foo[@]} != 1 ))
98 then err_exit 'number of elements of null variable foo is not 1'
100 unset foo
101 foo[0]=foo
102 foo[3]=bar
103 unset foo[0]
104 unset foo[3]
105 if (( ${#foo[@]} != 0 ))
106 then err_exit 'number of elements of left in variable foo is not 0'
108 unset foo
109 foo[3]=bar
110 foo[0]=foo
111 unset foo[3]
112 unset foo[0]
113 if (( ${#foo[@]} != 0 ))
114 then err_exit 'number of elements of left in variable foo again is not 0'
124 set -A foo -- "${x[@]}"
125 if (( ${#foo[@]} != 6 ))
126 then err_exit 'number of elements of foo is not 6'
132 x[2]=foo x[4]=bar
136 s[1]=1 c[1]=foo
137 if [[ ${c[s[1]]} != foo ]]
138 then err_exit 'c[1]=foo s[1]=1; ${c[s[1]]} != foo'
182 unset foo
183 typeset foo=bar
184 typeset -A foo
185 if [[ ${foo[0]} != bar ]]
188 unset foo
189 foo=(one two)
190 typeset -A foo
191 foo[two]=3
192 if [[ ${#foo[*]} != 3 ]]
200 xxx=foo
233 : $(set -A list foo bar)
238 list= (foo bar bam)
248 foo=( zero one '' three four '' six)
250 if [[ ${foo[@]:n} != six ]]
253 if [[ ${foo[@]: -3:1} != four ]]
257 unset foo
258 foo=one
259 foo=( $foo two)
260 if [[ ${#foo[@]} != 2 ]]
263 foo=(143 3643 38732)
264 export foo
265 typeset -i foo
266 if [[ $($SHELL -c 'print $foo') != 143 ]]
270 unset foo
271 typeset -A foo=([0]=143 [1]=3643 [2]=38732)
272 export foo
273 typeset -i foo
274 [[ $($SHELL -c "print $foo") == 143 ]]'
277 unset foo
278 typeset -A foo
279 foo[$((10))]=ok 2> /dev/null || err_exit 'arithmetic expression as subscript not working'
280 unset foo
281 typeset -A foo
282 integer foo=0
283 [[ $foo == 0 ]] || err_exit 'zero element of associative array not being set'
284 unset foo
285 typeset -A foo=( [two]=1)
287 do : ${foo[$i]}
289 if [[ ${!foo[@]} != two ]]
319 unset foo
320 [[ $(foo=good
322 do [[ ${foo[i]} ]] && print ok
325 x=([foo]=bar)
328 unset bam foo
329 foo=0
331 unset bam[foo]
332 bam[foo]=value
338 [[ $($SHELL -c "var=(foo bar);export var;$tmp/script") == foo ]] || err_exit 'export array not exporting just first element'
340 unset foo
342 foo=one
343 foo[1]=two
344 foo[0]=three
345 [[ $foo == three ]] || err_exit '--allexport not working with arrays'
347 unset foo
350 typeset -A foo
351 print foo${foo[abc]}
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'
355 unset foo
356 foo=(one two)
357 [[ ${foo[@]:1} == two ]] || err_exit '${foo[@]:1} == two'
358 [[ ! ${foo[@]:2} ]] || err_exit '${foo[@]:2} not null'
359 unset foo
360 foo=one
361 [[ ! ${foo[@]:1} ]] || err_exit '${foo[@]:1} not null'
370 unset foo
371 typeset -A foo
372 foo[bar]=bam
373 foo[x]=y
374 EMPTY foo
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'
378 unset foo
379 foo=bar
380 set -- "${foo[@]:1}"
381 (( $# == 0 )) || err_exit '${foo[@]:1} should not have any values'
389 unset foo bar
390 foo[5]=4
392 bar[0]=foo
393 foo[0]=bam
394 foo[4]=5
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'
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 (( ))'
403 x=${bar[$foo[5]]}
404 (( $x == 3 )) || err_exit '${bar[$foo[sub]]} not working'
425 unset foo bar
426 : ${foo[bar=2]}
428 unset foo bar
430 typeset -a foo=([1]=ok [2]=no)
431 [[ $foo[bar] == ok ]] || err_exit 'typeset -a not working for simple assignment'
432 unset foo
433 typeset -a foo=([1]=(x=ok) [2]=(x=no))
434 [[ $(typeset | grep 'foo$') == *index* ]] || err_exit 'typeset -a not creating an indexed array'
435 foo+=([5]=good)
436 [[ $(typeset | grep 'foo$') == *index* ]] || err_exit 'append to indexed array not preserving array type'
437 unset foo
438 typeset -A foo=([1]=ok [2]=no)
439 [[ $foo[bar] == ok ]] && err_exit 'typeset -A not working for simple assignment'
440 unset foo
441 typeset -A foo=([1]=(x=ok) [2]=(x=no))
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'
446 unset foo
447 foo[1]=(x=3 y=4)
448 { [[ ${!foo[1].*} == 'foo[1].x foo[1].y' ]] ;} 2> /dev/null || err_exit '${!foo[sub].*} not expanding correctly'
450 x=( typeset -a foo=( [0]="a" [1]="b" [2]="c" ))
451 [[ ${@x.foo} == 'typeset -a'* ]] || err_exit 'x.foo is not an indexed array'
452 x=( typeset -A foo=( [0]="a" [1]="b" [2]="c" ))
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'
465 a=([x]=1 [y]=2 [z]=(foo=3 bar=4))