about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-04-29 15:54:49 +0100
committerPeter Stephenson <pws@zsh.org>2015-04-29 15:54:49 +0100
commitbf258a1c07a9cf1119f83d1d15310b02b94f4d67 (patch)
treeaf7f12d596efe96213fd12ed3328e9342fc59107 /Test
parentc96a993d51e3e5958c8161d0dbe86cb43bcc52c1 (diff)
downloadzsh-bf258a1c07a9cf1119f83d1d15310b02b94f4d67.tar.gz
zsh-bf258a1c07a9cf1119f83d1d15310b02b94f4d67.tar.xz
zsh-bf258a1c07a9cf1119f83d1d15310b02b94f4d67.zip
34992: POSIX fix for readonly variables.
With POSIXBUILTINS, variables can be marked readonly if unset.
Also, variables can't have the readonly flag removed.
Diffstat (limited to 'Test')
-rw-r--r--Test/B02typeset.ztst17
1 files changed, 17 insertions, 0 deletions
diff --git a/Test/B02typeset.ztst b/Test/B02typeset.ztst
index 51ebc6535..f4fb8ecb9 100644
--- a/Test/B02typeset.ztst
+++ b/Test/B02typeset.ztst
@@ -468,3 +468,20 @@
 0:retying arrays to same array works
 >foo bar
 >goo car
+
+ (
+   setopt POSIXBUILTINS
+   readonly pbro
+   print ${+pbro} >&2
+   (typeset pbro=3)
+   (pbro=4)
+   typeset -r pbro        # idempotent (no error)...
+   print ${+pbro} >&2     # ...so still readonly...
+   typeset +r pbro        # ...can't turn it off
+ )
+1:Readonly with POSIX_BUILTINS
+?0
+?(eval):5: read-only variable: pbro
+?(eval):6: read-only variable: pbro
+?0
+?(eval):9: read-only variable: pbro