37348: Tests and fix for ${(q+)...}.

Needs dupstring() for empty string case.
This commit is contained in:
Peter Stephenson 2015-12-08 15:08:24 +00:00
parent 4105f79a3a
commit 7f5b2f5709
4 changed files with 26 additions and 1 deletions

View file

@ -1,5 +1,9 @@
2015-12-08 Peter Stephenson <p.stephenson@samsung.com>
* 37348: Src/utils.c, Test/D04parameter.ztst,
Test/D07multibyte.ztst: tests for ${(q+)...} and extra
dupstring() needed for empty string case.
* 37347: Functions/VCS_Info/VCS_INFO_nvcsformats: msgs
shouldn't be local here, but in caller (where it already is).

View file

@ -5940,7 +5940,7 @@ quotedzputs(char const *s, FILE *stream)
/* check for empty string */
if(!*s) {
if (!stream)
return "''";
return dupstring("''");
fputs("''", stream);
return NULL;
}

View file

@ -1866,3 +1866,17 @@
>0
>1 /somewhere
>2 /random /value
print -r -- ${(q+):-}
print -r -- ${(q+)IFS}
print -r -- ${(q+):-oneword}
print -r -- ${(q+):-two words}
print -r -- ${(q+):-three so-called \'words\'}
(setopt rcquotes; print -r -- ${(q+):-three so-called \'words\'})
0:${(q+)...}
>''
>$' \t\n\C-@'
>oneword
>'two words'
>'three so-called '\''words'\'
>'three so-called ''words'''

View file

@ -546,3 +546,10 @@
[[ $'\xe3\x83\x9b' != [[:INCOMPLETE:][:INVALID:]] ]] || print fail 3
[[ $'\xe3\x83\x9b' = ? ]] || print fail 4
0:Testing incomplete and invalid multibyte character components
print -r -- ${(q+):-ホ}
foo='She said "ホ". I said "You can'\''t '\''ホ'\'' me!'
print -r -- ${(q+)foo}
0:${(q+)...} with printable multibyte characters
>ホ
>'She said "ホ". I said "You can'\''t '\''ホ'\'' me!'