diff options
author | jilles <jilles@FreeBSD.org> | 2015-03-29 22:00:24 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2015-03-29 22:00:24 +0000 |
commit | 1e1b2bdf13c6802ac891f75c2bd1b40569158617 (patch) | |
tree | 65ec947071c65b2ca769c79f7d1da0d059735661 /tools/regression/lib/libc | |
parent | 07bd0d0266aaafdc79d4f84284724f20a740602a (diff) | |
download | FreeBSD-src-1e1b2bdf13c6802ac891f75c2bd1b40569158617.zip FreeBSD-src-1e1b2bdf13c6802ac891f75c2bd1b40569158617.tar.gz |
wordexp(): Add testcase for non-default IFS in environment.
The non-default IFS is expected to be used.
MFC after: 1 week
Diffstat (limited to 'tools/regression/lib/libc')
-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"); |