summaryrefslogtreecommitdiff
path: root/Test
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2024-02-23 09:51:06 -0800
committerBart Schaefer <schaefer@zsh.org>2024-02-23 09:51:06 -0800
commit4b9cd6b8bd5f67500e716f8485aebd31a9f7cf47 (patch)
tree5376037a7d85f0b43189308f2ea5c476fea74c55 /Test
parent40d5200c8b882708ecd411bd88760e20deec82fd (diff)
downloadzsh-4b9cd6b8bd5f67500e716f8485aebd31a9f7cf47.tar.gz
zsh-4b9cd6b8bd5f67500e716f8485aebd31a9f7cf47.zip
52583: extra check for proper scope and existence of readonly specials
Diffstat (limited to 'Test')
-rw-r--r--Test/V10private.ztst41
1 files changed, 41 insertions, 0 deletions
diff --git a/Test/V10private.ztst b/Test/V10private.ztst
index 4140d4e96..efa346002 100644
--- a/Test/V10private.ztst
+++ b/Test/V10private.ztst
@@ -312,6 +312,47 @@ F:future revision will create a global with this assignment
>UP:
() {
+ typeset -a ary
+ local -P -n ref=ary
+ {
+ (){
+ ref=XX # Should be an error
+ typeset -p ary ref
+ }
+ } always {
+ TRY_BLOCK_ERROR=0
+ typeset -p ary ref
+ }
+ }
+ typeset -p ary
+1:assignment to private nameref in wrong scope, part 1
+>typeset -a ary
+>typeset -hn ref=ary
+*?*ref: can't modify read-only parameter
+*?*no such variable: ary
+
+ () {
+ typeset -a ary
+ local -P -n ref=ary
+ {
+ (){
+ typeset ref=XX # Should create a local
+ typeset -p ary ref
+ }
+ } always {
+ TRY_BLOCK_ERROR=0
+ typeset -p ary ref
+ }
+ }
+ typeset -p ary
+1:assignment to private nameref in wrong scope, part 2
+>typeset -g -a ary
+>typeset ref=XX
+>typeset -a ary
+>typeset -hn ref=ary
+*?*no such variable: ary
+
+ () {
typeset -n ptr1=ptr2
private -n ptr2 # TYPESET_TO_UNSET makes this not a "placeholder"
typeset -p ptr1 ptr2