diff options
author | Evan Martin <martine@danga.com> | 2010-11-12 17:29:31 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2010-11-12 17:29:34 (GMT) |
commit | 06f72b1c8cccec1632cfab27380a88e69135f52e (patch) | |
tree | 437c4d67e69b931899406a4e80db841605e42111 /ninja_test.cc | |
parent | dd4ca7314aa5e9defc19a0f0ccc9faaa37d8c719 (diff) | |
download | Ninja-06f72b1c8cccec1632cfab27380a88e69135f52e.zip Ninja-06f72b1c8cccec1632cfab27380a88e69135f52e.tar.gz Ninja-06f72b1c8cccec1632cfab27380a88e69135f52e.tar.bz2 |
add two tests, one failing that exhibits problem
Diffstat (limited to 'ninja_test.cc')
-rw-r--r-- | ninja_test.cc | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/ninja_test.cc b/ninja_test.cc index d110777..2ce415d 100644 --- a/ninja_test.cc +++ b/ninja_test.cc @@ -119,6 +119,60 @@ TEST_F(PlanTest, Basic) { ASSERT_EQ(NULL, edge); } +TEST_F(PlanTest, DoubleOutputDirect) { + AssertParse(&state_, +"build out: cat mid1 mid2\n" +"build mid1 mid2: cat in\n"); + GetNode("in")->MarkDependentsDirty(); + string err; + EXPECT_TRUE(plan_.AddTarget(GetNode("out"), &err)); + ASSERT_EQ("", err); + ASSERT_TRUE(plan_.more_to_do()); + + Edge* edge; + edge = plan_.FindWork(); + ASSERT_TRUE(edge); // cat in + plan_.EdgeFinished(edge); + edge = plan_.FindWork(); + ASSERT_TRUE(edge); // cat mid1 mid2 + plan_.EdgeFinished(edge); + edge = plan_.FindWork(); + ASSERT_FALSE(edge); // done +} + +TEST_F(PlanTest, DoubleOutputIndirect) { + AssertParse(&state_, +"build out: cat b1 b2\n" +"build b1: cat a1\n" +"build b2: cat a2\n" +"build a1 a2: cat in\n"); + GetNode("in")->MarkDependentsDirty(); + string err; + EXPECT_TRUE(plan_.AddTarget(GetNode("out"), &err)); + ASSERT_EQ("", err); + ASSERT_TRUE(plan_.more_to_do()); + + Edge* edge; + edge = plan_.FindWork(); + ASSERT_TRUE(edge); // cat in + edge->Dump(); + plan_.EdgeFinished(edge); + edge = plan_.FindWork(); + ASSERT_TRUE(edge); // cat a1 + edge->Dump(); + plan_.EdgeFinished(edge); + edge = plan_.FindWork(); + ASSERT_TRUE(edge); // cat a2 + edge->Dump(); + plan_.EdgeFinished(edge); + edge = plan_.FindWork(); + ASSERT_TRUE(edge); // cat b1 b2 + edge->Dump(); + plan_.EdgeFinished(edge); + edge = plan_.FindWork(); + ASSERT_FALSE(edge); // done +} + struct BuildTest : public StateTestWithBuiltinRules, public Shell, public DiskInterface { |