Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [bug] shwordsplit not working on $@ when $# > 1



> Existing tests still pass, but then they always did, this needs a
> new one.  Holding off until we think of other edge cases.

This tests the significant cases with $@.

There's already quite a lot with splitting, joining, IFS and
SH_WORD_SPLIT in that file, so I'm not sure how much more there is to
do.

Not quite sure what forced joining gets us apart from extra complexity
but too late to worry now...

pws

diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 7cb297e..6767eb2 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -1920,3 +1920,38 @@
   print $array
 0:"-" works after "[" in same expression (Dash problem)
 >foo two three
+
+  (
+  setopt shwordsplit
+  IFS=:
+  set -- whim:wham:whom
+  print -l $@
+  )
+0:Splitting of $@ on IFS: single element
+>whim
+>wham
+>whom
+
+  (
+  setopt shwordsplit
+  IFS=:
+  set -- one:two bucklemy:shoe
+  print -l $@
+  )
+0:Splitting of $@ on IFS: multiple elements
+# No forced joining in this case
+>one
+>two
+>bucklemy
+>shoe
+
+  (
+  setopt shwordsplit
+  set -- one:two bucklemy:shoe
+  print -l ${(s.:.)@}
+  )
+0:Splitting of $@ on (s): multiple elements
+# Forced joining in this case
+>one
+>two bucklemy
+>shoe



Messages sorted by: Reverse Date, Date, Thread, Author