diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/varenv.right | 4 | ||||
-rw-r--r-- | tests/varenv12.sub | 25 |
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/varenv.right b/tests/varenv.right index b8620227..82845dfe 100644 --- a/tests/varenv.right +++ b/tests/varenv.right @@ -159,6 +159,10 @@ inside func1: var=value outside 3.0: var=value inside func2: var=global outside 4.0: var=outside +foo: hello world +after foo: var=outside +bar: hello world +after bar: var=bar: hello world ./varenv13.sub: line 3: `var[0]': not a valid identifier ./varenv13.sub: line 3: `var[@]': not a valid identifier ./varenv13.sub: line 1: declare: var: not found diff --git a/tests/varenv12.sub b/tests/varenv12.sub index 7e384ac7..f286cfbd 100644 --- a/tests/varenv12.sub +++ b/tests/varenv12.sub @@ -131,3 +131,28 @@ func2() var=outside func2 echo -n 'outside 4.0: ' ; echo "var=${var-<unset>}" + +unset -v var +unset -f fecho foo bar + +fecho() { + echo $var +} + +foo() { + local var="foo: bye bye" + var="foo: hello world" fecho +} + +bar() { + var="bar: hello world" fecho +} + +var=global +var=outside foo +echo after foo: var=$var +var=global +var=outside bar +echo after bar: var=$var + +unset -v var |