Index: base/files/file_path_unittest.cc |
diff --git a/base/files/file_path_unittest.cc b/base/files/file_path_unittest.cc |
index 9a690a9b56f947436e669d7313c840c994451166..28778d9856169ab65e81b719dab3e10a55ca5ebf 100644 |
--- a/base/files/file_path_unittest.cc |
+++ b/base/files/file_path_unittest.cc |
@@ -1196,7 +1196,34 @@ TEST_F(FilePathTest, NormalizePathSeparators) { |
"i: " << i << ", input: " << input.value(); |
} |
} |
- |
#endif |
+TEST_F(FilePathTest, EndsWithSeparator) { |
+ const UnaryBooleanTestData cases[] = { |
+ { FPL(""), false }, |
+ { FPL("/"), true }, |
+ { FPL("foo/"), true }, |
+ { FPL("bar"), false }, |
+ { FPL("/foo/bar"), false }, |
+ }; |
+ for (size_t i = 0; i < arraysize(cases); ++i) { |
+ FilePath input = FilePath(cases[i].input).NormalizePathSeparators(); |
+ EXPECT_EQ(cases[i].expected, input.EndsWithSeparator()); |
+ } |
+} |
+ |
+TEST_F(FilePathTest, AsEndingWithSeparator) { |
+ const UnaryTestData cases[] = { |
+ { FPL(""), FPL("") }, |
+ { FPL("/"), FPL("/") }, |
+ { FPL("foo"), FPL("foo/") }, |
+ { FPL("foo/"), FPL("foo/") } |
+ }; |
+ for (size_t i = 0; i < arraysize(cases); ++i) { |
+ FilePath input = FilePath(cases[i].input).NormalizePathSeparators(); |
+ FilePath expected = FilePath(cases[i].expected).NormalizePathSeparators(); |
+ EXPECT_EQ(expected.value(), input.AsEndingWithSeparator().value()); |
+ } |
+} |
+ |
} // namespace base |