aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/cpp/util/file_windows_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/cpp/util/file_windows_test.cc')
-rw-r--r--src/test/cpp/util/file_windows_test.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/cpp/util/file_windows_test.cc b/src/test/cpp/util/file_windows_test.cc
index 85cc7a491e..00486d4fa9 100644
--- a/src/test/cpp/util/file_windows_test.cc
+++ b/src/test/cpp/util/file_windows_test.cc
@@ -65,4 +65,32 @@ TEST(FileTest, TestBasename) {
ASSERT_EQ("foo", Basename("\\\\?\\c:\\foo"));
}
+TEST(FileTest, IsAbsolute) {
+ ASSERT_FALSE(IsAbsolute(""));
+ ASSERT_TRUE(IsAbsolute("/"));
+ ASSERT_TRUE(IsAbsolute("/foo"));
+ ASSERT_TRUE(IsAbsolute("\\"));
+ ASSERT_TRUE(IsAbsolute("\\foo"));
+ ASSERT_FALSE(IsAbsolute("c:"));
+ ASSERT_TRUE(IsAbsolute("c:/"));
+ ASSERT_TRUE(IsAbsolute("c:\\"));
+ ASSERT_TRUE(IsAbsolute("c:\\foo"));
+ ASSERT_TRUE(IsAbsolute("\\\\?\\c:\\"));
+ ASSERT_TRUE(IsAbsolute("\\\\?\\c:\\foo"));
+}
+
+TEST(FileTest, IsRootDirectory) {
+ ASSERT_FALSE(IsRootDirectory(""));
+ ASSERT_TRUE(IsRootDirectory("/"));
+ ASSERT_FALSE(IsRootDirectory("/foo"));
+ ASSERT_TRUE(IsRootDirectory("\\"));
+ ASSERT_FALSE(IsRootDirectory("\\foo"));
+ ASSERT_FALSE(IsRootDirectory("c:"));
+ ASSERT_TRUE(IsRootDirectory("c:/"));
+ ASSERT_TRUE(IsRootDirectory("c:\\"));
+ ASSERT_FALSE(IsRootDirectory("c:\\foo"));
+ ASSERT_TRUE(IsRootDirectory("\\\\?\\c:\\"));
+ ASSERT_FALSE(IsRootDirectory("\\\\?\\c:\\foo"));
+}
+
} // namespace blaze_util