check in failing chain test

This commit is contained in:
Evan Martin 2010-10-20 00:03:09 -07:00
parent 3af3511a66
commit ac1b574e38
2 changed files with 19 additions and 2 deletions

View File

@ -13,12 +13,16 @@ using namespace std;
struct Node;
struct FileStat {
FileStat(const string& path) : path_(path), mtime_(0), node_(NULL) {}
FileStat(const string& path) : path_(path), mtime_(-1), node_(NULL) {}
void Touch(int mtime);
// Return true if the file exists (mtime_ got a value).
bool Stat();
string path_;
// Possible values of mtime_:
// -1: file hasn't been examined
// 0: we looked, and file doesn't exist
// >0: actual file's mtime
time_t mtime_;
Node* node_;
};

View File

@ -156,7 +156,12 @@ void BuildTest::LoadManifest() {
"\n"
"build cat1: cat in1\n"
"build cat2: cat in1 in2\n"
"build cat12: cat cat1 cat2\n",
"build cat12: cat cat1 cat2\n"
"\n"
"build c2: cat c1\n"
"build c3: cat c2\n"
"build c4: cat c3\n"
"build c5: cat c4\n",
&err));
ASSERT_EQ("", err);
}
@ -237,3 +242,11 @@ TEST_F(BuildTest, TwoStep) {
EXPECT_EQ("cat in1 in2 > cat2", commands_ran_[3]);
EXPECT_EQ("cat cat1 cat2 > cat12", commands_ran_[4]);
}
TEST_F(BuildTest, Chain) {
string err;
builder_.AddTarget("c5");
EXPECT_TRUE(builder_.Build(this, &err));
EXPECT_EQ("", err);
ASSERT_EQ(5, commands_ran_.size());
}