add Path::is_file() and Path::is_dir()

This commit is contained in:
josh committed 2016-07-06 19:40:35 -04:00
1 parent 1f9a981e6a
commit 2012591b27
3 files changed
+57

No files matched your search

+32
View File
@@ -61,3 +61,35 @@ TEST(Path_join, does_not_add_extra_slash_when_first_path_already_ends_with_one)
{
EXPECT_EQ("/var/run", Path::join("/var/", "run"));
}
TEST(Path_is_file, returns_true_for_file)
{
EXPECT_TRUE(Path::is_file("test/src/test_Path.cc"));
}
TEST(Path_is_file, returns_false_for_directory)
{
EXPECT_FALSE(Path::is_file("test"));
}
TEST(Path_is_file, returns_false_for_nonexistent_path)
{
EXPECT_FALSE(Path::is_file("non.existent"));
}
TEST(Path_is_dir, returns_true_for_directory)
{
EXPECT_TRUE(Path::is_dir("test/src"));
}
TEST(Path_is_dir, returns_false_for_file)
{
EXPECT_FALSE(Path::is_dir("test/src/test_Path.cc"));
}
TEST(Path_is_dir, returns_false_for_nonexistent_path)
{
EXPECT_FALSE(Path::is_dir("non.existent"));
}