aboutsummaryrefslogtreecommitdiff
path: root/paludis/util/process_TEST.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-19 18:45:40 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-21 14:58:16 +0100
commit1bb84c09850dcf2136bc9134ead3409a3ccaf547 (patch)
treec740028982d8655ab4fa337dc34509f8b8328999 /paludis/util/process_TEST.cc
parent625454e26c1ea5fa5640135d34f043adeec54527 (diff)
downloadpaludis-1bb84c09850dcf2136bc9134ead3409a3ccaf547.tar.gz
paludis-1bb84c09850dcf2136bc9134ead3409a3ccaf547.tar.xz
Process::chdir
Diffstat (limited to 'paludis/util/process_TEST.cc')
-rw-r--r--paludis/util/process_TEST.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/paludis/util/process_TEST.cc b/paludis/util/process_TEST.cc
index 9688c07c7..a882151c3 100644
--- a/paludis/util/process_TEST.cc
+++ b/paludis/util/process_TEST.cc
@@ -18,6 +18,7 @@
*/
#include <paludis/util/process.hh>
+#include <paludis/util/fs_entry.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
#include <sstream>
@@ -161,5 +162,21 @@ namespace test_cases
TEST_CHECK_EQUAL(stdout_stream.str(), "in space\n");
}
} test_setenv;
+
+ struct ChdirTest : TestCase
+ {
+ ChdirTest() : TestCase("chdir") { }
+
+ void run()
+ {
+ std::stringstream stdout_stream;
+ Process pwd_process(ProcessCommand({"pwd"}));
+ pwd_process.capture_stdout(stdout_stream);
+ pwd_process.chdir(FSEntry("/"));
+
+ TEST_CHECK_EQUAL(pwd_process.run().wait(), 0);
+ TEST_CHECK_EQUAL(stdout_stream.str(), "/\n");
+ }
+ } test_chdir;
}