improve test
authorScott Graham <scottmg@chromium.org>
Sun, 9 Nov 2014 07:32:21 +0000 (23:32 -0800)
committerScott Graham <scottmg@chromium.org>
Sun, 9 Nov 2014 07:32:21 +0000 (23:32 -0800)
src/build_test.cc

index f25dd5f..912e3ef 100644 (file)
@@ -943,17 +943,19 @@ TEST_F(BuildTest, DepFileCanonicalize) {
   int orig_edges = state_.edges_.size();
   ASSERT_NO_FATAL_FAILURE(AssertParse(&state_,
 "rule cc\n  command = cc $in\n  depfile = $out.d\n"
-"build gen/stuff/foo.o: cc foo.c\n"));
+"build gen/stuff\\things/foo.o: cc x\\y/z\\foo.c\n"));
   Edge* edge = state_.edges_.back();
 
-  fs_.Create("foo.c", "");
+  fs_.Create("x/y/z/foo.c", "");
   GetNode("bar.h")->MarkDirty();  // Mark bar.h as missing.
   // Note, different slashes from manifest.
-  fs_.Create("gen/stuff/foo.o.d", "gen\\stuff\\foo.o: blah.h bar.h\n");
-  EXPECT_TRUE(builder_.AddTarget("gen/stuff/foo.o", &err));
+  fs_.Create("gen/stuff\\things/foo.o.d",
+             "gen\\stuff\\things\\foo.o: blah.h bar.h\n");
+  EXPECT_TRUE(builder_.AddTarget("gen/stuff/things/foo.o", &err));
   ASSERT_EQ("", err);
   ASSERT_EQ(1u, fs_.files_read_.size());
-  EXPECT_EQ("gen/stuff/foo.o.d", fs_.files_read_[0]);
+  // The depfile path does not get Canonicalize as it seems unnecessary.
+  EXPECT_EQ("gen/stuff\\things/foo.o.d", fs_.files_read_[0]);
 
   // Expect three new edges: one generating foo.o, and two more from
   // loading the depfile.
@@ -961,8 +963,9 @@ TEST_F(BuildTest, DepFileCanonicalize) {
   // Expect our edge to now have three inputs: foo.c and two headers.
   ASSERT_EQ(3u, edge->inputs_.size());
 
-  // Expect the command line we generate to only use the original input.
-  ASSERT_EQ("cc foo.c", edge->EvaluateCommand());
+  // Expect the command line we generate to only use the original input, and
+  // using the slashes from the manifest.
+  ASSERT_EQ("cc x\\y/z\\foo.c", edge->EvaluateCommand());
 }
 #endif