From 8aac69241f5882e379509b3688c2f8e78cc71171 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 6 Oct 2010 08:27:09 +0000 Subject: 28319: (z) splitting oddities --- Test/D04parameter.ztst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'Test/D04parameter.ztst') diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index 4594e62fd..fe978263f 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -389,6 +389,34 @@ >) >ten( more + strings=( + 'foo=(1 2 3)' + '(( 3 + 1 == 8 / 2 ))' + 'for (( i = 1 ; i < 10 ; i++ ))' + ) + for string in $strings; do + array=(${(z)string}) + for (( i = 1; i <= ${#array}; i++ )); do + print -r -- "${i}:${array[i]}:" + done + done +0:Some syntactical expressions that are hard to split into words with (z). +>1:foo=(: +>2:1: +>3:2: +>4:3: +>5:): +>1:(( 3 + 1 == 8 / 2 )): +>1:for: +>2:((: +# Leading whitespace is removed, because the word proper hasn't started; +# trailing whitespace is left because the word is terminated by the +# semicolon or double parentheses. Bit confusing but sort of consistent. +>3:i = 1 ;: +>4:i < 10 ;: +>5:i++ : +>6:)): + psvar=(dog) setopt promptsubst foo='It shouldn'\''t $(happen) to a %1v.' -- cgit 1.4.1