summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-11-06 17:28:02 +0000
committerPeter Stephenson <pws@zsh.org>2015-11-06 17:28:02 +0000
commit0fcc6c8fb28f4cc61520770da2156de3a124e432 (patch)
tree3185650c165d825a8b86f0315e6ce63e3a043968 /Test
parent20153c573e1d9156fdee02fb854298bc0b88545f (diff)
downloadzsh-0fcc6c8fb28f4cc61520770da2156de3a124e432.tar.gz
zsh-0fcc6c8fb28f4cc61520770da2156de3a124e432.tar.xz
zsh-0fcc6c8fb28f4cc61520770da2156de3a124e432.zip
37073: another SH_WORD_SPLIT problem.
In cases like x${:- y} the space was simply removed instead of
being used for splitting.
Diffstat (limited to 'Test')
-rw-r--r--Test/D04parameter.ztst54
1 files changed, 54 insertions, 0 deletions
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index cb7079c98..59c14a408 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -1744,3 +1744,57 @@
 >3_4_5_6
 >6
 >1_2_3_4_5_6
+
+ (setopt shwordsplit
+ do_test() {
+   print $#: "$@"
+ }
+ foo=bar
+ foo2="bar bar"
+ do_test ${:- foo}
+ do_test ${:- foo bar}
+ do_test ${:- $foo}
+ do_test ${:- $foo2}
+ do_test x${:- foo}
+ do_test x${:- foo bar}
+ do_test x${:- $foo}
+ do_test x${:- $foo2}
+ do_test x${foo:+ $foo}
+ )
+0:We Love SH_WORD_SPLIT Day celebrated with space at start of internal subst
+>1: foo
+>2: foo bar
+>1: bar
+>2: bar bar
+>2: x foo
+>3: x foo bar
+>2: x bar
+>3: x bar bar
+>2: x bar
+
+ (unsetopt shwordsplit # default, for clarity
+ do_test() {
+   print $#: "$@"
+ }
+ foo=bar
+ foo2="bar bar"
+ do_test ${:- foo}
+ do_test ${:- foo bar}
+ do_test ${:- $foo}
+ do_test ${:- $foo2}
+ do_test x${:- foo}
+ do_test x${:- foo bar}
+ do_test x${:- $foo}
+ do_test x${:- $foo2}
+ do_test x${foo:+ $foo}
+ )
+0:We Love NO_SH_WORD_SPLIT Even More Day celebrated as sanity check
+>1:  foo
+>1:  foo bar
+>1:  bar
+>1:  bar bar
+>1: x foo
+>1: x foo bar
+>1: x bar
+>1: x bar bar
+>1: x bar