diff options
author | Elliott Hughes <enh@google.com> | 2015-07-30 22:56:01 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-07-30 22:56:01 +0000 |
commit | 0cf93dc345cd5e8131009146a3b2767b1c60f77b (patch) | |
tree | dc103f77af449c2840cd1e31cb00f2a2cf7bd7ea /adb/adb_utils_test.cpp | |
parent | d548e30f04b2eb7aa00deab42f5559d08396c38e (diff) | |
parent | 47d67c96ec991ef1690b4c07188335cbc4bfa2aa (diff) |
Merge "Write mkdirs in more idiomatic C++ style."
Diffstat (limited to 'adb/adb_utils_test.cpp')
-rw-r--r-- | adb/adb_utils_test.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/adb/adb_utils_test.cpp b/adb/adb_utils_test.cpp index 7aa610ab50..20dba2771a 100644 --- a/adb/adb_utils_test.cpp +++ b/adb/adb_utils_test.cpp @@ -18,6 +18,13 @@ #include <gtest/gtest.h> +#include <stdlib.h> +#include <string.h> + +#include "sysdeps.h" + +#include <base/test_utils.h> + TEST(adb_utils, directory_exists) { ASSERT_TRUE(directory_exists("/proc")); ASSERT_FALSE(directory_exists("/proc/self")); // Symbolic link. @@ -132,3 +139,11 @@ TEST(adb_utils, parse_host_and_port) { EXPECT_FALSE(parse_host_and_port("1.2.3.4:0", &canonical_address, &host, &port, &error)); EXPECT_FALSE(parse_host_and_port("1.2.3.4:65536", &canonical_address, &host, &port, &error)); } + +TEST(adb_utils, mkdirs) { + TemporaryDir td; + EXPECT_TRUE(mkdirs(std::string(td.path) + "/dir/subdir/file")); + std::string file = std::string(td.path) + "/file"; + adb_creat(file.c_str(), 0600); + EXPECT_FALSE(mkdirs(file + "/subdir/")); +} |