about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2001-04-24 05:45:16 +0000
committerBart Schaefer <barts@users.sourceforge.net>2001-04-24 05:45:16 +0000
commite2e912189359b20efc0b178fd913728e38502b3e (patch)
treefd7e5a3f3b739ef300f061d2de9f6fafa3a40f27 /Test
parentfe8d375ca077fc8c1982fd8c907f2546b127d09a (diff)
downloadzsh-e2e912189359b20efc0b178fd913728e38502b3e.tar.gz
zsh-e2e912189359b20efc0b178fd913728e38502b3e.tar.xz
zsh-e2e912189359b20efc0b178fd913728e38502b3e.zip
Subscripting optimization and error checking.
Diffstat (limited to 'Test')
-rw-r--r--Test/D06subscript.ztst26
1 files changed, 22 insertions, 4 deletions
diff --git a/Test/D06subscript.ztst b/Test/D06subscript.ztst
index 4a96b01ab..d7ba59b3f 100644
--- a/Test/D06subscript.ztst
+++ b/Test/D06subscript.ztst
@@ -93,14 +93,15 @@
 >\? \2 \? \?
 >\\]
 
+  eval 'A[*]=star'
+1:Illegal associative array assignment
+?ZTST_execchunk:2: A: attempt to set slice of associative array
+
   x='*'
   A[$x]=xstar
   A[${(q)x}]=qxstar
   print -R ${(k)A[(r)xstar]} $A[$x]
   print -R ${(k)A[(r)qxstar]} $A[${(q)x}]
-  # A[*] is interpreted specially, assignment to it fails silently (oops)
-  A[*]=star
-  print -R ${(k)A[(r)star]} $A[$x]
   A[(e)*]=star
   A[\*]=backstar
   print -R ${(k)A[(r)star]} $A[(e)*]
@@ -108,7 +109,6 @@
 0:Associative array assignment
 >* xstar
 >\* qxstar
->xstar
 >* star
 >\* backstar
 
@@ -160,3 +160,21 @@
 >QqQq
 >qqq
 >QQQ
+
+  print ${x::=$A[$A[(i)one\"two\"three\"quotes]]}
+  print $x
+  print ${x::="$A[$A[(i)one\"two\"three\"quotes]]"}
+  print $x
+0:More keys with double quotes, used in assignment-expansion
+>qqq
+>qqq
+>QQQ
+>QQQ
+
+  qqq=lower
+  QQQ=upper
+  print ${(P)A[one\"two\"three\"quotes]}
+  print "${(P)A[$A[(i)one\"two\"three\"quotes]]}"
+0:Keys with double quotes and the (P) expansion flag
+>lower
+>upper