summaryrefslogtreecommitdiff
path: root/base/file_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'base/file_test.cpp')
-rw-r--r--base/file_test.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/base/file_test.cpp b/base/file_test.cpp
index ed39ce973..bbd503783 100644
--- a/base/file_test.cpp
+++ b/base/file_test.cpp
@@ -162,3 +162,15 @@ TEST(file, Readlink) {
TEST(file, GetExecutablePath) {
ASSERT_NE("", android::base::GetExecutablePath());
}
+
+TEST(file, Basename) {
+ EXPECT_EQ("sh", android::base::Basename("/system/bin/sh"));
+ EXPECT_EQ("sh", android::base::Basename("sh"));
+ EXPECT_EQ("sh", android::base::Basename("/system/bin/sh/"));
+}
+
+TEST(file, Dirname) {
+ EXPECT_EQ("/system/bin", android::base::Dirname("/system/bin/sh"));
+ EXPECT_EQ(".", android::base::Dirname("sh"));
+ EXPECT_EQ("/system/bin", android::base::Dirname("/system/bin/sh/"));
+}