diff options
author | Qingning Huo <qingninghuo@gmail.com> | 2012-01-25 21:28:57 (GMT) |
---|---|---|
committer | Qingning Huo <qingninghuo@gmail.com> | 2012-01-25 21:28:57 (GMT) |
commit | 50c3475f47436d375d69e505e1c474c156e484fe (patch) | |
tree | 080f4915c21415862f94f0209c407adced6eec9b /src | |
parent | 665a30bc2dc78940ff3e1ec90d2f5bb7d329a71c (diff) | |
download | Ninja-50c3475f47436d375d69e505e1c474c156e484fe.zip Ninja-50c3475f47436d375d69e505e1c474c156e484fe.tar.gz Ninja-50c3475f47436d375d69e505e1c474c156e484fe.tar.bz2 |
Add a test, NoSuchCommand.
Diffstat (limited to 'src')
-rw-r--r-- | src/subprocess_test.cc | 18 |
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)); |