summaryrefslogtreecommitdiffstats
path: root/tests/varenv14.sub
blob: 52b20d8161718ddfd539a36cd36826c30805038f (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
# testing framework for local variable inheritence

shopt -s localvar_inherit
declare -A var

f() { declare var+=([0]=X); declare -p var; }
f

f() { declare var=([Y]=Y); declare -p var; }; f
f() { declare var+=([Y]=Y); declare -p var; }; f
f() { declare var+=(); declare -p var; }; f
f() { declare var=(); declare -p var; }; f

unset -f f
unset -v var

declare -a var=( [0]=12 )
f() { declare -A var+=([0]=X); declare -p var; }
f

unset -f f
unset a s

a=(X) s=X

f() { local -a a s; declare -p a s; }
f

f() { local a+=(Y) s+=(Y); declare -p a s; }
f

f() { local -a a+=Y s+=Y; declare -p a s; }
f