about summary refs log tree commit diff
path: root/posix/wordexp-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'posix/wordexp-test.c')
-rw-r--r--posix/wordexp-test.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c
index 03a5d3a9b1..56bac3f3ea 100644
--- a/posix/wordexp-test.c
+++ b/posix/wordexp-test.c
@@ -89,6 +89,9 @@ struct test_case_struct
     { 0, "foo", "\"$var\"\"$var\"", 0, 1, { "foofoo", }, IFS },
     { 0, NULL, "'singly-quoted'", 0, 1, { "singly-quoted", }, IFS },
     { 0, NULL, "contin\\\nuation", 0, 1, { "continuation", }, IFS },
+    { 0, NULL, "explicit ''", 0, 2, { "explicit", "", }, IFS },
+    { 0, NULL, "explicit \"\"", 0, 2, { "explicit", "", }, IFS },
+    { 0, NULL, "explicit ``", 0, 1, { "explicit", }, IFS },
 
     /* Simple command substitution */
     { 0, NULL, "$(echo hello)", 0, 1, { "hello", }, IFS },
@@ -244,6 +247,7 @@ main (int argc, char *argv[])
     if (testit (&test_case[test]))
       ++fail;
 
+  /* Tilde-expansion tests. */
   pw = getpwnam ("root");
   if (pw != NULL)
     {
@@ -259,6 +263,17 @@ main (int argc, char *argv[])
 
       if (testit (&ts))
 	++fail;
+
+      ts.retval = 0;
+      ts.env = pw->pw_dir;
+      ts.words = "${var#~root}x";
+      ts.flags = 0;
+      ts.wordc = 1;
+      ts.wordv[0] = "x";
+      ts.ifs = IFS;
+
+      if (testit (&ts))
+	++fail;
     }
 
   puts ("tests completed, now cleaning up");