diff options
author | jilles <jilles@FreeBSD.org> | 2015-04-19 13:46:13 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2015-04-19 13:46:13 +0000 |
commit | 87307718d2a664b264cd061938f5292a1ec168b4 (patch) | |
tree | da57b39528277eaeb062e5eef744882d8b4d189f /tools/regression/lib | |
parent | d7f7bac629f6a2a0ce72b81964acef4829ca9436 (diff) | |
download | FreeBSD-src-87307718d2a664b264cd061938f5292a1ec168b4.zip FreeBSD-src-87307718d2a664b264cd061938f5292a1ec168b4.tar.gz |
MFC r280830: wordexp(): Add testcase for non-default IFS in environment.
The non-default IFS is expected to be used.
Diffstat (limited to 'tools/regression/lib')
-rw-r--r-- | tools/regression/lib/libc/gen/test-wordexp.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/regression/lib/libc/gen/test-wordexp.c b/tools/regression/lib/libc/gen/test-wordexp.c index 15d1b7c..069190f 100644 --- a/tools/regression/lib/libc/gen/test-wordexp.c +++ b/tools/regression/lib/libc/gen/test-wordexp.c @@ -240,6 +240,21 @@ main(int argc, char *argv[]) r = unsetenv("IFS"); assert(r == 0); + /* + * With IFS set to a non-default value, and using it. + */ + r = setenv("IFS", ":", 1); + assert(r == 0); + r = wordexp("${IFS+hello:world}", &we, 0); + assert(r == 0); + assert(we.we_wordc == 2); + assert(strcmp(we.we_wordv[0], "hello") == 0); + assert(strcmp(we.we_wordv[1], "world") == 0); + assert(we.we_wordv[2] == NULL); + wordfree(&we); + r = unsetenv("IFS"); + assert(r == 0); + printf("PASS wordexp()\n"); printf("PASS wordfree()\n"); |