+
+void ProcessTest::testEnv() {
+#ifdef __WIN32
+# error "TODO: implement Process tests for windows"
+#else
+ {
+ const string test_input("Hello, environment");
+ const string expected_output("Hello, environment\n");
+ Process proc("/usr/bin/env", { "env", "sh", "-c", "echo $BLANK_ENV_TEST" }, { "BLANK_ENV_TEST=" + test_input });
+ char buffer[expected_output.length() + 1];
+ size_t len = proc.ReadOut(buffer, sizeof(buffer));
+ const string output(buffer, len);
+ int status = proc.Join();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "exit status of echo assumed 0",
+ 0, status);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "unexpected length of echo output",
+ expected_output.size(), len);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "unexpected error output of echo",
+ expected_output, output);
+ }
+
+#endif
+}
+