diff options
author | Nico Weber <thakis@chromium.org> | 2014-06-27 22:58:32 (GMT) |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2014-06-27 22:58:32 (GMT) |
commit | 51de49bbdca11ab6c1f7963f77d48e0b08246489 (patch) | |
tree | 7876de5618936ace56c9afb52122b1c772f6b414 | |
parent | 95c03b40bfe4ea5c8383bba25b4a2f42068e4e9d (diff) | |
download | Ninja-51de49bbdca11ab6c1f7963f77d48e0b08246489.zip Ninja-51de49bbdca11ab6c1f7963f77d48e0b08246489.tar.gz Ninja-51de49bbdca11ab6c1f7963f77d48e0b08246489.tar.bz2 |
add more tests for stat()ing a directory
-rw-r--r-- | src/disk_interface_test.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/disk_interface_test.cc b/src/disk_interface_test.cc index 18e48a2..b2e8cb5 100644 --- a/src/disk_interface_test.cc +++ b/src/disk_interface_test.cc @@ -78,7 +78,14 @@ TEST_F(DiskInterfaceTest, StatExistingFile) { 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 @@ -88,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")); @@ -95,10 +103,17 @@ TEST_F(DiskInterfaceTest, StatCache) { EXPECT_GT(disk_.Stat("FIle1"), 1); EXPECT_GT(disk_.Stat("file1"), 1); - EXPECT_GT(disk_.Stat("subdir"), 1); 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"); |