summaryrefslogtreecommitdiff
path: root/Test/V10private.ztst
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@ipost.com>2021-04-18 13:58:09 -0700
committerBart Schaefer <schaefer@ipost.com>2021-04-18 13:58:09 -0700
commit82ff9f24f170eea7daa935fdaa09ab75a2f277ff (patch)
treecef3fef19fbe032466fcfbe50b7b6aa0878300a5 /Test/V10private.ztst
parent56ccb4a975bc87dd10bbbd6a1cfc296d6e2203b4 (diff)
downloadzsh-82ff9f24f170eea7daa935fdaa09ab75a2f277ff.tar.gz
zsh-82ff9f24f170eea7daa935fdaa09ab75a2f277ff.zip
48560: add TYPESET_TO_UNSET option to remove initialization of parameters
Changes typeset such that ${newparam-notset} yields "notset" and "typeset -p newparam" does not show an assignment to the parameter. This is similar to the default behavior of bash and ksh, with minor differences in typeset output. Also add tests for some POSIX incompatibilities plus minor changes for test harness robustness.
Diffstat (limited to 'Test/V10private.ztst')
-rw-r--r--Test/V10private.ztst12
1 files changed, 6 insertions, 6 deletions
diff --git a/Test/V10private.ztst b/Test/V10private.ztst
index a3a63867b..03e8259d5 100644
--- a/Test/V10private.ztst
+++ b/Test/V10private.ztst
@@ -19,14 +19,14 @@
() {
print $scalar_test
private scalar_test
- print $+scalar_test
+ typeset +m scalar_test
unset scalar_test
print $+scalar_test
}
print $scalar_test
0:basic scope hiding
>toplevel
->1
+>local scalar_test
>0
>toplevel
@@ -45,14 +45,14 @@
print $+unset_test
() {
private unset_test
- print $+unset_test
+ typeset +m unset_test
unset_test=setme
print $unset_test
}
print $+unset_test
0:variable defined only in scope
>0
->1
+>local unset_test
>setme
>0
@@ -62,13 +62,13 @@
local -Pa array_test=(in function)
() {
private array_test
- print $+array_test
+ typeset +m array_test
}
print $array_test
}
print $array_test
0:nested scope with different type, correctly restored
->1
+>local array_test
>in function
>top level