diff options
Diffstat (limited to 'Test')
-rw-r--r-- | Test/D04parameter.ztst | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index 79aecb6c3..433f7743b 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -282,6 +282,7 @@ print ${(P)bar} 0:${(P)...} >I'm nearly out of my mind with tedium +#' deconfuse emacs foo=(I could be watching that programme I recorded) print ${(o)foo} @@ -375,6 +376,7 @@ print ${(QX)foo} 1:${(QX)...} ?(eval):2: unmatched " +# " deconfuse emacs array=(characters in an array) print ${(c)#array} @@ -411,6 +413,7 @@ print ${(pl.10..\x22..X.)foo} 0:${(pl...)...} >Xresulting """"Xwords roariously """Xpadded +#" deconfuse emacs print ${(l.5..X.r.5..Y.)foo} print ${(l.6..X.r.4..Y.)foo} @@ -870,6 +873,7 @@ 0:Parameters associated with backreferences >match 12 16 match >1 1 1 +#' deconfuse emacs string='and look for a MATCH in here' if [[ ${(S)string%%(#m)M*H} = "and look for a in here" ]]; then @@ -1010,3 +1014,36 @@ >fields >in >it + + array=('%' '$' 'j' '*' '$foo') + print ${array[(i)*]} "${array[(i)*]}" + print ${array[(ie)*]} "${array[(ie)*]}" + key='$foo' + print ${array[(ie)$key]} "${array[(ie)$key]}" + key='*' + print ${array[(ie)$key]} "${array[(ie)$key]}" +0:Matching array indices with and without quoting +>1 1 +>4 4 +>5 5 +>4 4 + +# Ordering of associative arrays is arbitrary, so we need to use +# patterns that only match one element. + typeset -A assoc_r + assoc_r=(star '*' of '*this*' and '!that!' or '(the|other)') + print ${(kv)assoc_r[(re)*]} + print ${(kv)assoc_r[(re)*this*]} + print ${(kv)assoc_r[(re)!that!]} + print ${(kv)assoc_r[(re)(the|other)]} + print ${(kv)assoc_r[(r)*at*]} + print ${(kv)assoc_r[(r)*(ywis|bliss|kiss|miss|this)*]} + print ${(kv)assoc_r[(r)(this|that|\(the\|other\))]} +0:Reverse subscripting associative arrays with literal matching +>star * +>of *this* +>and !that! +>or (the|other) +>and !that! +>of *this* +>or (the|other) |