add a regression test which our current mksh does not pass,

but the one fixed by a diff by jaredy@openbsd (which intro-
duces other problems though):
Log message:
Change the behavior of IFS word-splitting:  split words
when the current character is IFS space and the last
character was a word character or it was non-white IFS
space and the current character is non-white IFS space.
This deviates from the previous behavior because the
latter splits words when the last character is any IFS
space and the current is non-white IFS, resulting in
more fields most of the time.

This new behavior follows what the man page describes;
i.e., that a field is delimited by one or more IFS
whitespace characters followed by zero or one non-white
IFS characters.
This commit is contained in:
tg 2004-11-26 15:30:15 +00:00
parent 6b85a22986
commit 5cb41399fe

View File

@ -159,3 +159,17 @@ expected-stdout:
<10> <h> <ith> <ere>
<11> <h:ith:ere>
---
name: IFS-subst-2
description:
manual page test, IFS=<space>:
stdin:
showargs() { for i; do echo -n " <$i>"; done; echo; }
IFS=" :"
x=" A : B::D"
echo -n '1:'; for i in $x ; do echo -n " [$i]" ; done ; echo
showargs 2 $x
expected-stdout:
1: [A] [B] [] [D]
<2> <A> <B> <> <D>
---