diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-05-13 14:24:58 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-05-13 14:52:18 +0300 |
commit | 07930c5ee74b8d2645fc55465833ab84e2f4444a (patch) | |
tree | 45ca5b8b787987a9c6a5980bddd7d6db13e070c7 /tests/wordsplit.at | |
parent | 3e07e3ad30e8a7a091e213eb4df839b7cf7f1e64 (diff) | |
download | grecs-07930c5ee74b8d2645fc55465833ab84e2f4444a.tar.gz grecs-07930c5ee74b8d2645fc55465833ab84e2f4444a.tar.bz2 |
wordsplit: return single empty string on empty input in WRDSF_NOSPLIT mode
* src/wordsplit.c (wordsplit_finish): Make sure at one non-null
argument is always returned in WRDSF_NOSPLIT mode.
* tests/wordsplit.at: Add new test.
Diffstat (limited to 'tests/wordsplit.at')
-rw-r--r-- | tests/wordsplit.at | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/wordsplit.at b/tests/wordsplit.at index 631d939..e3af703 100644 --- a/tests/wordsplit.at +++ b/tests/wordsplit.at | |||
@@ -262,7 +262,7 @@ TOTAL: 2 | |||
262 | [], | 262 | [], |
263 | [FOO=bar BAZ=qux]) | 263 | [FOO=bar BAZ=qux]) |
264 | 264 | ||
265 | TESTWSP([nosplit with expansion],[wsp-var-nosplit],[nosplit], | 265 | TESTWSP([nosplit with variable expansion],[wsp-var-nosplit],[nosplit], |
266 | [a $FOO test], | 266 | [a $FOO test], |
267 | [NF: 1 | 267 | [NF: 1 |
268 | 0: "a variable expansion test\n" | 268 | 0: "a variable expansion test\n" |
@@ -271,7 +271,7 @@ TOTAL: 1 | |||
271 | [], | 271 | [], |
272 | [FOO="variable expansion"]) | 272 | [FOO="variable expansion"]) |
273 | 273 | ||
274 | TESTWSP([nosplit without expansion],[],[nosplit novar], | 274 | TESTWSP([nosplit without variable expansion],[],[nosplit novar], |
275 | [a $FOO test], | 275 | [a $FOO test], |
276 | [NF: 1 | 276 | [NF: 1 |
277 | 0: "a $FOO test\n" | 277 | 0: "a $FOO test\n" |
@@ -280,6 +280,15 @@ TOTAL: 1 | |||
280 | [], | 280 | [], |
281 | [FOO="variable expansion"]) | 281 | [FOO="variable expansion"]) |
282 | 282 | ||
283 | TESTWSP([nosplit: empty expansion],[],[nosplit trimnl], | ||
284 | [$FOO], | ||
285 | [NF: 1 | ||
286 | 0: "" | ||
287 | TOTAL: 1 | ||
288 | ], | ||
289 | [], | ||
290 | [FOO=""]) | ||
291 | |||
283 | TESTWSP([default value (defined)],[],[], | 292 | TESTWSP([default value (defined)],[],[], |
284 | [${FOO:-bar}], | 293 | [${FOO:-bar}], |
285 | [NF: 1 | 294 | [NF: 1 |