summaryrefslogtreecommitdiff
path: root/tools/aapt2/util/Files_test.cpp
diff options
context:
space:
mode:
authorBill Peckham <bpeckham@google.com>2018-10-09 17:33:34 -0700
committerBill Peckham <bpeckham@google.com>2018-10-15 17:46:00 -0700
commitddcaa93e851eb5e57692799446f2ef3fe31436ae (patch)
tree41f5481541b8c4e26dd8fef5cbba7a24aa1003c7 /tools/aapt2/util/Files_test.cpp
parent760f366150e46580bfa808a897bc99c3e8907ded (diff)
parentef229d9195a2bdff34f94420687c0c05f4447a88 (diff)
Merge QP1A.181008.001
Change-Id: Iff68e8d0501ac5c2998c96f9df4042a94a1ce9e1
Diffstat (limited to 'tools/aapt2/util/Files_test.cpp')
-rw-r--r--tools/aapt2/util/Files_test.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/tools/aapt2/util/Files_test.cpp b/tools/aapt2/util/Files_test.cpp
index 219c18397358..202cc261ad89 100644
--- a/tools/aapt2/util/Files_test.cpp
+++ b/tools/aapt2/util/Files_test.cpp
@@ -18,11 +18,21 @@
#include <sstream>
+#include "android-base/stringprintf.h"
+
#include "test/Test.h"
+using ::android::base::StringPrintf;
+
namespace aapt {
namespace file {
+#ifdef _WIN32
+constexpr const char sTestDirSep = '\\';
+#else
+constexpr const char sTestDirSep = '/';
+#endif
+
class FilesTest : public ::testing::Test {
public:
void SetUp() override {
@@ -42,16 +52,16 @@ TEST_F(FilesTest, AppendPath) {
}
TEST_F(FilesTest, AppendPathWithLeadingOrTrailingSeparators) {
- std::string base = "hello/";
+ std::string base = StringPrintf("hello%c", sTestDirSep);
AppendPath(&base, "there");
EXPECT_EQ(expected_path_, base);
base = "hello";
- AppendPath(&base, "/there");
+ AppendPath(&base, StringPrintf("%cthere", sTestDirSep));
EXPECT_EQ(expected_path_, base);
- base = "hello/";
- AppendPath(&base, "/there");
+ base = StringPrintf("hello%c", sTestDirSep);
+ AppendPath(&base, StringPrintf("%cthere", sTestDirSep));
EXPECT_EQ(expected_path_, base);
}