diff options
author | Evan Martin <martine@danga.com> | 2012-04-26 03:13:10 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2012-04-26 03:13:10 (GMT) |
commit | c2098f931b6d93b6eae406598e2b46c175bd969f (patch) | |
tree | bd6611e7b056b9a217de0b67fb7a3f1bcea62527 /src/clean_test.cc | |
parent | 5d6249fa8c3d6241f46701f43fd48db576714ae4 (diff) | |
parent | 3353e5508614598ff18592bda55f68a6223911cf (diff) | |
download | Ninja-c2098f931b6d93b6eae406598e2b46c175bd969f.zip Ninja-c2098f931b6d93b6eae406598e2b46c175bd969f.tar.gz Ninja-c2098f931b6d93b6eae406598e2b46c175bd969f.tar.bz2 |
Merge branch 'dont-clean-phony' of git://github.com/pcc/ninja
Conflicts:
src/clean.cc
Diffstat (limited to 'src/clean_test.cc')
-rw-r--r-- | src/clean_test.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/clean_test.cc b/src/clean_test.cc index 2e3a6b0..5ed48da 100644 --- a/src/clean_test.cc +++ b/src/clean_test.cc @@ -347,3 +347,28 @@ TEST_F(CleanTest, CleanFailure) { Cleaner cleaner(&state_, config_, &fs_); EXPECT_NE(0, cleaner.CleanAll()); } + +TEST_F(CleanTest, CleanPhony) { + ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, +"build phony: phony t1 t2\n" +"build t1: cat\n" +"build t2: cat\n")); + + fs_.Create("phony", 1, ""); + fs_.Create("t1", 1, ""); + fs_.Create("t2", 1, ""); + + // Check that CleanAll does not remove "phony". + Cleaner cleaner(&state_, config_, &fs_); + EXPECT_EQ(0, cleaner.CleanAll()); + EXPECT_EQ(2, cleaner.cleaned_files_count()); + EXPECT_NE(0, fs_.Stat("phony")); + + fs_.Create("t1", 1, ""); + fs_.Create("t2", 1, ""); + + // Check that CleanTarget does not remove "phony". + EXPECT_EQ(0, cleaner.CleanTarget("phony")); + EXPECT_EQ(2, cleaner.cleaned_files_count()); + EXPECT_NE(0, fs_.Stat("phony")); +} |