summaryrefslogtreecommitdiffstats
path: root/src/clean_test.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2012-04-11 00:07:42 (GMT)
committerEvan Martin <martine@danga.com>2012-04-11 00:07:42 (GMT)
commit16cab01cccf0b3ccadb150cd54f760929b3cc07e (patch)
treee48717680d84bfaa778be1d6b5d67909543b2568 /src/clean_test.cc
parent39bf6c94701d089f70b761ce8247356df751203d (diff)
parentef505e4573b14c802b1e5c2891694fa3c4e677e1 (diff)
downloadNinja-16cab01cccf0b3ccadb150cd54f760929b3cc07e.zip
Ninja-16cab01cccf0b3ccadb150cd54f760929b3cc07e.tar.gz
Ninja-16cab01cccf0b3ccadb150cd54f760929b3cc07e.tar.bz2
Merge pull request #252 from qhuo/remove-depfile-when-cleaning
Remove depfiles when running "ninja -t clean <target>" or "ninja -t clean -r <rule>"
Diffstat (limited to 'src/clean_test.cc')
-rw-r--r--src/clean_test.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/clean_test.cc b/src/clean_test.cc
index fbbe6a1..2e3a6b0 100644
--- a/src/clean_test.cc
+++ b/src/clean_test.cc
@@ -249,6 +249,36 @@ TEST_F(CleanTest, CleanDepFile) {
EXPECT_EQ(2u, fs_.files_removed_.size());
}
+TEST_F(CleanTest, CleanDepFileOnCleanTarget) {
+ ASSERT_NO_FATAL_FAILURE(AssertParse(&state_,
+"rule cc\n"
+" command = cc $in > $out\n"
+" depfile = $out.d\n"
+"build out1: cc in1\n"));
+ fs_.Create("out1", 1, "");
+ fs_.Create("out1.d", 1, "");
+
+ Cleaner cleaner(&state_, config_, &fs_);
+ EXPECT_EQ(0, cleaner.CleanTarget("out1"));
+ EXPECT_EQ(2, cleaner.cleaned_files_count());
+ EXPECT_EQ(2u, fs_.files_removed_.size());
+}
+
+TEST_F(CleanTest, CleanDepFileOnCleanRule) {
+ ASSERT_NO_FATAL_FAILURE(AssertParse(&state_,
+"rule cc\n"
+" command = cc $in > $out\n"
+" depfile = $out.d\n"
+"build out1: cc in1\n"));
+ fs_.Create("out1", 1, "");
+ fs_.Create("out1.d", 1, "");
+
+ Cleaner cleaner(&state_, config_, &fs_);
+ EXPECT_EQ(0, cleaner.CleanRule("cc"));
+ EXPECT_EQ(2, cleaner.cleaned_files_count());
+ EXPECT_EQ(2u, fs_.files_removed_.size());
+}
+
TEST_F(CleanTest, CleanRspFile) {
ASSERT_NO_FATAL_FAILURE(AssertParse(&state_,
"rule cc\n"