aboutsummaryrefslogtreecommitdiff
path: root/paludis/util/process_TEST.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/util/process_TEST.cc')
-rw-r--r--paludis/util/process_TEST.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/paludis/util/process_TEST.cc b/paludis/util/process_TEST.cc
index 8eedf0306..f872836c5 100644
--- a/paludis/util/process_TEST.cc
+++ b/paludis/util/process_TEST.cc
@@ -304,6 +304,18 @@ TEST(Process, Clearenv)
EXPECT_EQ("", stdout_stream.str());
}
+TEST(Process, ClearenvPres)
+{
+ ::setenv("PALUDIS_BANANAS", "PALUDIS_IN PYJAMAS", 1);
+ std::stringstream stdout_stream;
+ Process printenv_process(ProcessCommand({"printenv", "PALUDIS_BANANAS"}));
+ printenv_process.capture_stdout(stdout_stream);
+ printenv_process.clearenv();
+
+ EXPECT_EQ(0, printenv_process.run().wait());
+ EXPECT_EQ("PALUDIS_IN PYJAMAS\n", stdout_stream.str());
+}
+
TEST(Process, SendFD)
{
std::stringstream stdout_stream, in_stream;
@@ -330,3 +342,9 @@ TEST(Process, SendFDFixed)
EXPECT_EQ("monkey\n", stdout_stream.str());
}
+TEST(Process, ExecError)
+{
+ Process process(ProcessCommand({"paludis-nonexisting-command"}));
+ EXPECT_THROW({ process.run(); }, ProcessError);
+}
+