1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-07-13 05:21:40 +02:00

39028: more join/split cases fixed and tested.

This commit is contained in:
Barton E. Schaefer 2016-08-12 00:55:32 -07:00
parent 4234fccef6
commit 68e14c41f2
3 changed files with 17 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2016-08-12 Barton E. Schaefer <schaefer@zsh.org>
* 39028: Src/subst.c, Test/D04parameter.ztst: more join/split
cases fixed and tested.
2016-08-10 Barton E. Schaefer <schaefer@zsh.org>
* 39019 (cf. PWS 39013): Src/subst.c, Test/D04parameter.ztst:

View file

@ -3461,11 +3461,12 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
val = sepjoin(aval, sep, 1);
isarr = 0;
ms_flags = 0;
} else if (force_split && nojoin == 2) {
} else if (force_split && (spsep || nojoin == 2)) {
/* Hack to simulate splitting individual elements:
* first join on what we later use to split
* forced joining as previously determined, or
* join on what we later use to forcibly split
*/
val = sepjoin(aval, spsep, 1);
val = sepjoin(aval, (nojoin == 1 ? sep : spsep), 1);
isarr = 0;
}
}

View file

@ -1970,8 +1970,14 @@
set -- one:two bucklemy:shoe
IFS=
setopt shwordsplit
print -l ${@}
print -l ${@} ${(s.:.)*} ${(s.:.j.-.)*}
)
0:Joining of $@ does not happen when IFS is empty
0:Joining of $@ does not happen when IFS is empty, but splitting $* does
>one:two
>bucklemy:shoe
>one
>twobucklemy
>shoe
>one
>two-bucklemy
>shoe