From e2e912189359b20efc0b178fd913728e38502b3e Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Tue, 24 Apr 2001 05:45:16 +0000 Subject: Subscripting optimization and error checking. --- Test/D06subscript.ztst | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'Test') 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 -- cgit 1.4.1