CD: Fix a bug and add a regression test.
authorBen Pfaff <blp@cs.stanford.edu>
Wed, 15 Jun 2011 05:38:13 +0000 (22:38 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 15 Jun 2011 05:38:13 +0000 (22:38 -0700)
src/language/utilities/cd.c
tests/automake.mk
tests/language/utilities/cd.at [new file with mode: 0644]

index cae84eb3c46b43e6f06bf2b3bb43e941a517bdd4..d28c0a30aa126d4a6b894e2e511a0d3607f21f47 100644 (file)
@@ -48,6 +48,7 @@ cmd_cd (struct lexer *lexer, struct dataset *ds UNUSED)
     }
 
   free (path);
+  lex_get (lexer);
 
   return CMD_SUCCESS;
 
index d02c59fe9d3952a30a692931c3fb514ec0190a8a..61c7996fb9501097d1eca7fcff43c966d3778bf7 100644 (file)
@@ -316,6 +316,7 @@ TESTSUITE_AT = \
        tests/language/stats/sort-cases.at \
        tests/language/stats/t-test.at \
        tests/language/utilities/cache.at \
+       tests/language/utilities/cd.at \
        tests/language/utilities/date.at \
        tests/language/utilities/insert.at \
        tests/language/utilities/permissions.at \
diff --git a/tests/language/utilities/cd.at b/tests/language/utilities/cd.at
new file mode 100644 (file)
index 0000000..f56f1b8
--- /dev/null
@@ -0,0 +1,13 @@
+AT_BANNER([CD])
+
+AT_SETUP([CD])
+mkdir subdir
+AT_DATA([cd.sps], [dnl
+cd 'subdir'.
+host command=[['pwd > mydir']].
+])
+AT_CHECK([pspp -O format=csv cd.sps])
+AT_CAPTURE_FILE([subdir/mydir])
+AT_CHECK([sed 's,.*/,,' subdir/mydir], [0], [subdir
+])
+AT_CLEANUP