diff options
author | Evan Martin <martine@danga.com> | 2012-09-02 18:03:01 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2012-09-02 18:05:51 (GMT) |
commit | fd91e0dc26d18209f7625730bb0e653f8321fff9 (patch) | |
tree | 3220f1082693486d0b2ba196afe3e791aecff3c7 /src/graph_test.cc | |
parent | df6d995790ee15317fd9ddb47c9d59f30265afe5 (diff) | |
download | Ninja-fd91e0dc26d18209f7625730bb0e653f8321fff9.zip Ninja-fd91e0dc26d18209f7625730bb0e653f8321fff9.tar.gz Ninja-fd91e0dc26d18209f7625730bb0e653f8321fff9.tar.bz2 |
split out dirty recomputation logic from Edge class
Rather than passing States and DiskInterfaces through all the calls,
put the necessary ambient information in a new DependencyScan object
and move the code accordingly.
Note: I didn't move the source location of the functions to preserve
history, though this does result in a sort of weird order for the
functions in graph.cc.
Diffstat (limited to 'src/graph_test.cc')
-rw-r--r-- | src/graph_test.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/graph_test.cc b/src/graph_test.cc index 4b41f8a..2bc0c17 100644 --- a/src/graph_test.cc +++ b/src/graph_test.cc @@ -17,7 +17,10 @@ #include "test.h" struct GraphTest : public StateTestWithBuiltinRules { + GraphTest() : scan_(&state_, &fs_) {} + VirtualFileSystem fs_; + DependencyScan scan_; }; TEST_F(GraphTest, MissingImplicit) { @@ -28,7 +31,7 @@ TEST_F(GraphTest, MissingImplicit) { Edge* edge = GetNode("out")->in_edge(); string err; - EXPECT_TRUE(edge->RecomputeDirty(&state_, &fs_, &err)); + EXPECT_TRUE(scan_.RecomputeDirty(edge, &err)); ASSERT_EQ("", err); // A missing implicit dep *should* make the output dirty. @@ -46,7 +49,7 @@ TEST_F(GraphTest, ModifiedImplicit) { Edge* edge = GetNode("out")->in_edge(); string err; - EXPECT_TRUE(edge->RecomputeDirty(&state_, &fs_, &err)); + EXPECT_TRUE(scan_.RecomputeDirty(edge, &err)); ASSERT_EQ("", err); // A modified implicit dep should make the output dirty. @@ -66,7 +69,7 @@ TEST_F(GraphTest, FunkyMakefilePath) { Edge* edge = GetNode("out.o")->in_edge(); string err; - EXPECT_TRUE(edge->RecomputeDirty(&state_, &fs_, &err)); + EXPECT_TRUE(scan_.RecomputeDirty(edge, &err)); ASSERT_EQ("", err); // implicit.h has changed, though our depfile refers to it with a @@ -89,7 +92,7 @@ TEST_F(GraphTest, ExplicitImplicit) { Edge* edge = GetNode("out.o")->in_edge(); string err; - EXPECT_TRUE(edge->RecomputeDirty(&state_, &fs_, &err)); + EXPECT_TRUE(scan_.RecomputeDirty(edge, &err)); ASSERT_EQ("", err); // We have both an implicit and an explicit dep on implicit.h. @@ -110,7 +113,7 @@ TEST_F(GraphTest, PathWithCurrentDirectory) { Edge* edge = GetNode("out.o")->in_edge(); string err; - EXPECT_TRUE(edge->RecomputeDirty(&state_, &fs_, &err)); + EXPECT_TRUE(scan_.RecomputeDirty(edge, &err)); ASSERT_EQ("", err); EXPECT_FALSE(GetNode("out.o")->dirty()); @@ -154,7 +157,7 @@ TEST_F(GraphTest, DepfileWithCanonicalizablePath) { Edge* edge = GetNode("out.o")->in_edge(); string err; - EXPECT_TRUE(edge->RecomputeDirty(&state_, &fs_, &err)); + EXPECT_TRUE(scan_.RecomputeDirty(edge, &err)); ASSERT_EQ("", err); EXPECT_FALSE(GetNode("out.o")->dirty()); @@ -174,13 +177,13 @@ TEST_F(GraphTest, DepfileRemoved) { Edge* edge = GetNode("out.o")->in_edge(); string err; - EXPECT_TRUE(edge->RecomputeDirty(&state_, &fs_, &err)); + EXPECT_TRUE(scan_.RecomputeDirty(edge, &err)); ASSERT_EQ("", err); EXPECT_FALSE(GetNode("out.o")->dirty()); state_.Reset(); fs_.RemoveFile("out.o.d"); - EXPECT_TRUE(edge->RecomputeDirty(&state_, &fs_, &err)); + EXPECT_TRUE(scan_.RecomputeDirty(edge, &err)); ASSERT_EQ("", err); EXPECT_TRUE(GetNode("out.o")->dirty()); } |