summaryrefslogtreecommitdiffstats
path: root/src/subprocess_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/subprocess_test.cc')
-rw-r--r--src/subprocess_test.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/subprocess_test.cc b/src/subprocess_test.cc
index 47b7b56..840287b 100644
--- a/src/subprocess_test.cc
+++ b/src/subprocess_test.cc
@@ -45,6 +45,24 @@ TEST_F(SubprocessTest, BadCommandStderr) {
EXPECT_NE("", subproc->GetOutput());
}
+// Run a command that does not exist
+TEST_F(SubprocessTest, NoSuchCommand) {
+ Subprocess* subproc = new Subprocess;
+ EXPECT_TRUE(subproc->Start(&subprocs_, "ninja_no_such_command"));
+ subprocs_.Add(subproc);
+
+ while (!subproc->Done()) {
+ // Pretend we discovered that stderr was ready for writing.
+ subprocs_.DoWork();
+ }
+
+ EXPECT_FALSE(subproc->Finish());
+ EXPECT_NE("", subproc->GetOutput());
+#ifdef _WIN32
+ ASSERT_EQ("CreateProcess failed: The system cannot find the file specified.\n", subproc->GetOutput());
+#endif
+}
+
TEST_F(SubprocessTest, SetWithSingle) {
Subprocess* subproc = new Subprocess;
EXPECT_TRUE(subproc->Start(&subprocs_, kSimpleCommand));