diff options
-rw-r--r-- | src/disk_interface.cc | 2 | ||||
-rw-r--r-- | src/disk_interface_test.cc | 21 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/disk_interface.cc b/src/disk_interface.cc index ae2146e..b170f63 100644 --- a/src/disk_interface.cc +++ b/src/disk_interface.cc @@ -117,8 +117,6 @@ bool StatAllFilesInDir(const string& dir, map<string, TimeStamp>* stamps, return false; } do { - if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - continue; string lowername = ffd.cFileName; transform(lowername.begin(), lowername.end(), lowername.begin(), ::tolower); stamps->insert(make_pair(lowername, diff --git a/src/disk_interface_test.cc b/src/disk_interface_test.cc index f4e0bb0..b2e8cb5 100644 --- a/src/disk_interface_test.cc +++ b/src/disk_interface_test.cc @@ -76,6 +76,18 @@ TEST_F(DiskInterfaceTest, StatExistingFile) { EXPECT_GT(disk_.Stat("file"), 1); } +TEST_F(DiskInterfaceTest, StatExistingDir) { + ASSERT_TRUE(disk_.MakeDir("subdir")); + ASSERT_TRUE(disk_.MakeDir("subdir/subsubdir")); + EXPECT_GT(disk_.Stat("."), 1); + EXPECT_GT(disk_.Stat("subdir"), 1); + EXPECT_GT(disk_.Stat("subdir/subsubdir"), 1); + + EXPECT_EQ(disk_.Stat("subdir"), disk_.Stat("subdir/.")); + EXPECT_EQ(disk_.Stat("subdir"), disk_.Stat("subdir/subsubdir/..")); + EXPECT_EQ(disk_.Stat("subdir/subsubdir"), disk_.Stat("subdir/subsubdir/.")); +} + #ifdef _WIN32 TEST_F(DiskInterfaceTest, StatCache) { disk_.AllowStatCache(true); @@ -83,6 +95,7 @@ TEST_F(DiskInterfaceTest, StatCache) { ASSERT_TRUE(Touch("file1")); ASSERT_TRUE(Touch("fiLE2")); ASSERT_TRUE(disk_.MakeDir("subdir")); + ASSERT_TRUE(disk_.MakeDir("subdir/subsubdir")); ASSERT_TRUE(Touch("subdir\\subfile1")); ASSERT_TRUE(Touch("subdir\\SUBFILE2")); ASSERT_TRUE(Touch("subdir\\SUBFILE3")); @@ -93,6 +106,14 @@ TEST_F(DiskInterfaceTest, StatCache) { EXPECT_GT(disk_.Stat("subdir/subfile2"), 1); EXPECT_GT(disk_.Stat("sUbdir\\suBFile1"), 1); + EXPECT_GT(disk_.Stat("."), 1); + EXPECT_GT(disk_.Stat("subdir"), 1); + EXPECT_GT(disk_.Stat("subdir/subsubdir"), 1); + + EXPECT_EQ(disk_.Stat("subdir"), disk_.Stat("subdir/.")); + EXPECT_EQ(disk_.Stat("subdir"), disk_.Stat("subdir/subsubdir/..")); + EXPECT_EQ(disk_.Stat("subdir/subsubdir"), disk_.Stat("subdir/subsubdir/.")); + // Test error cases. disk_.quiet_ = true; string bad_path("cc:\\foo"); |