summaryrefslogtreecommitdiff
path: root/posix/wordexp-test.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-09-13 08:30:54 +0000
committerUlrich Drepper <drepper@redhat.com>1998-09-13 08:30:54 +0000
commit1720f4d0a5262bdbae1260d582e1d6a444ecd509 (patch)
tree00abe6e61c3e3856272acc38819a2298f97df051 /posix/wordexp-test.c
parent2d09b95d5a6f8c4398197ddfb2a48be866ba6357 (diff)
downloadglibc-1720f4d0a5262bdbae1260d582e1d6a444ecd509.tar.gz
Update.
1998-09-13 14:53 Tim Waugh <tim@cyberelk.demon.co.uk> * posix/wordexp-test.c: Field-splitting ':abc:' with IFS=: should yield three fields, not two. Test both parameter expansion and command substitution for correct field-splitting behaviour. * posix/wordexp.c (w_emptyword): New function. (parse_param): Use it. (exec_comm): Likewise, for consistency with the way parse_param splits fields. (parse_param): Fix some memory leaks.
Diffstat (limited to 'posix/wordexp-test.c')
-rw-r--r--posix/wordexp-test.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c
index 19048dca88..1815241fca 100644
--- a/posix/wordexp-test.c
+++ b/posix/wordexp-test.c
@@ -51,8 +51,19 @@ struct test_case_struct
{ 0, "two three", "one $var", 0, 3, { "one", "two", "three", }, IFS },
{ 0, "two three", "one \"$var\"", 0, 2, { "one", "two three", }, "" },
{ 0, "two three", "one $var", 0, 2, { "one", "two three", }, "" },
- { 0, ":abc:", "$var", 0, 2, { "", "abc", }, ":" }, /* cf. bash */
+ { 0, ":abc:", "$var", 0, 3, { "", "abc", "", }, ":" },
+ { 0, NULL, "$(echo :abc:)", 0, 3, { "", "abc", "", }, ":" },
+ { 0, NULL, "$(echo :abc:\\ )", 0, 3, { "", "abc", "", }, ": " },
+ { 0, NULL, "$(echo :abc\\ )", 0, 2, { "", "abc", }, ": " },
+ { 0, ":abc:", "$(echo $var)", 0, 3, { "", "abc", "", }, ":" },
{ 0, NULL, ":abc:", 0, 1, { " abc ", }, ":" },
+ { 0, NULL, "$(echo :abc:)def", 0, 3, { "", "abc", "def", }, ":" },
+ { 0, NULL, "$(echo abc:de)f", 0, 2, { "abc", "def", }, ":" },
+ { 0, NULL, "$(echo abc:de)f:ghi", 0, 2, { "abc", "def ghi", }, ":" },
+ { 0, "abc:", "$var$(echo def:ghi)", 0, 3, { "abc", "def", "ghi", }, ":" },
+ { 0, "abc:d", "$var$(echo ef:ghi)", 0, 3, { "abc", "def", "ghi", }, ":" },
+ { 0, "def:ghi", "$(echo abc:)$var", 0, 3, { "abc", "def", "ghi", }, ":" },
+ { 0, "ef:ghi", "$(echo abc:d)$var", 0, 3, { "abc", "def", "ghi", }, ":" },
/* Simple parameter expansion */
{ 0, "foo", "${var}", 0, 1, { "foo", }, IFS },