Correct read behavior for unset values and update tests accordingly

`read` with IFS empty was expected to set all parameters after the first
n filled variables to an empty string, but that was inconsistent with
the behavior of `read` everywhere else.

I'm not sure why fish differed from the spec with regards to the
behavior in the event of an empty IFS: we eschew IFS where possible, yet
here we adopt non-standard behavior splitting on every (unicode)
character instead of not splitting at all with IFS empty. We still do
that, but now the unset variables are treated as they normally would be,
i.e. cleared and not set to an empty string (which is what an empty
value between two IFS separators would contain).
This commit is contained in:
Mahmoud Al-Qudsi 2018-04-17 21:20:57 -05:00
parent 3742a7827f
commit c2cfc65cf2

View file

@ -35,9 +35,9 @@ two
1 'hello' 1 'hello'
1 'h' 1 'ello' 1 'h' 1 'ello'
1 'h' 1 'e' 1 'llo' 1 'h' 1 'e' 1 'llo'
1 '' 0
1 't' 1 '' 1 't' 0
1 't' 1 '' 1 '' 1 't' 0 0
1 ' ' 1 't' 1 ' ' 1 't'
2 'hello' 'there' 2 'hello' 'there'