aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/cpp/util/file_test.cc
diff options
context:
space:
mode:
authorGravatar Ulf Adams <ulfjack@google.com>2015-08-07 09:58:58 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2015-08-10 10:09:12 +0000
commitd2ae11fb4524e9fe8897c43f5aa2307b5ea531e7 (patch)
treeafd54ce8aeb6b7333f711f12fb2ff71ca5c1c6a7 /src/test/cpp/util/file_test.cc
parent518b24624987c7f3bb8b7339cdcedcd0756567b0 (diff)
Externalize file_test and strings_test, and fix up the BUILD files.
-- MOS_MIGRATED_REVID=100109450
Diffstat (limited to 'src/test/cpp/util/file_test.cc')
-rw-r--r--src/test/cpp/util/file_test.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/test/cpp/util/file_test.cc b/src/test/cpp/util/file_test.cc
new file mode 100644
index 0000000000..eb81165c9c
--- /dev/null
+++ b/src/test/cpp/util/file_test.cc
@@ -0,0 +1,39 @@
+// Copyright 2014 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+#include "src/main/cpp/util/file.h"
+#include "gtest/gtest.h"
+
+namespace blaze_util {
+
+TEST(BlazeUtil, JoinPath) {
+ string path = JoinPath("", "");
+ ASSERT_EQ("", path);
+
+ path = JoinPath("a", "b");
+ ASSERT_EQ("a/b", path);
+
+ path = JoinPath("a/", "b");
+ ASSERT_EQ("a/b", path);
+
+ path = JoinPath("a", "/b");
+ ASSERT_EQ("a/b", path);
+
+ path = JoinPath("a/", "/b");
+ ASSERT_EQ("a/b", path);
+
+ path = JoinPath("/", "/");
+ ASSERT_EQ("/", path);
+}
+
+} // namespace blaze_util