summaryrefslogtreecommitdiff
path: root/adb/adb_utils_test.cpp
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2015-11-03 18:52:35 -0800
committerJosh Gao <jmgao@google.com>2015-11-04 14:21:35 -0800
commit787f3442cc7d7b1f07189d77413893e2c2c81447 (patch)
tree2b1ac02be20908dfec7509707b908d0412da11bd /adb/adb_utils_test.cpp
parentff2e26b239e931236c9acecdc2a22d540b3e0c3d (diff)
adb: make adb_basename match the POSIX behavior.
Previously, adb_basename was behaving according to the GNU, POSIX-incompatible basename, despite POSIX adb_dirname existing alongside it. This patch changes adb_basename to pass through to the POSIX basename. Bug: http://b/25456821 Change-Id: I62a4865cccf3b9cdbc112e3e53ff475aa4a23bd9
Diffstat (limited to 'adb/adb_utils_test.cpp')
-rw-r--r--adb/adb_utils_test.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/adb/adb_utils_test.cpp b/adb/adb_utils_test.cpp
index 4a2787a529..93c20cb00e 100644
--- a/adb/adb_utils_test.cpp
+++ b/adb/adb_utils_test.cpp
@@ -102,6 +102,13 @@ TEST(adb_utils, escape_arg) {
TEST(adb_utils, adb_basename) {
EXPECT_EQ("sh", adb_basename("/system/bin/sh"));
EXPECT_EQ("sh", adb_basename("sh"));
+ EXPECT_EQ("sh", adb_basename("/system/bin/sh/"));
+}
+
+TEST(adb_utils, adb_dirname) {
+ EXPECT_EQ("/system/bin", adb_dirname("/system/bin/sh"));
+ EXPECT_EQ(".", adb_dirname("sh"));
+ EXPECT_EQ("/system/bin", adb_dirname("/system/bin/sh/"));
}
TEST(adb_utils, parse_host_and_port) {