Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3028)

Unified Diff: base/strings/string_util_unittest.cc

Issue 1280473002: Update ToLower/UpperASCII API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/strings/string_util.cc ('k') | chrome/browser/chromeos/input_method/input_method_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/strings/string_util_unittest.cc
diff --git a/base/strings/string_util_unittest.cc b/base/strings/string_util_unittest.cc
index eb6cd7ecfc14d873e3b88d8af1b34dd031e88a22..fee7bc91c638b60edfc4fe751f24d74bd3ed09f2 100644
--- a/base/strings/string_util_unittest.cc
+++ b/base/strings/string_util_unittest.cc
@@ -503,6 +503,19 @@ TEST(StringUtilTest, ConvertASCII) {
EXPECT_EQ(0, string_with_nul.compare(narrow_with_nul));
}
+TEST(StringUtilTest, ToLowerASCII) {
+ EXPECT_EQ('c', ToLowerASCII('C'));
+ EXPECT_EQ('c', ToLowerASCII('c'));
+ EXPECT_EQ('2', ToLowerASCII('2'));
+
+ EXPECT_EQ(L'c', ToLowerASCII(L'C'));
yzshen1 2015/08/05 23:21:04 The compiler complains about ambiguity. It doesn't
brettw 2015/08/06 17:13:53 Actually this test just needed updating. I decided
+ EXPECT_EQ(L'c', ToLowerASCII(L'c'));
+ EXPECT_EQ(L'2', ToLowerASCII(L'2'));
+
+ EXPECT_EQ("cc2", ToLowerASCII("Cc2"));
+ EXPECT_EQ(ASCIIToUTF16("cc2"), ToLowerASCII(ASCIIToUTF16("Cc2")));
+}
+
TEST(StringUtilTest, ToUpperASCII) {
EXPECT_EQ('C', ToUpperASCII('C'));
EXPECT_EQ('C', ToUpperASCII('c'));
@@ -512,21 +525,8 @@ TEST(StringUtilTest, ToUpperASCII) {
EXPECT_EQ(L'C', ToUpperASCII(L'c'));
EXPECT_EQ(L'2', ToUpperASCII(L'2'));
- std::string in_place_a("Cc2");
- StringToUpperASCII(&in_place_a);
- EXPECT_EQ("CC2", in_place_a);
-
- std::wstring in_place_w(L"Cc2");
- StringToUpperASCII(&in_place_w);
- EXPECT_EQ(L"CC2", in_place_w);
-
- std::string original_a("Cc2");
- std::string upper_a = StringToUpperASCII(original_a);
- EXPECT_EQ("CC2", upper_a);
-
- std::wstring original_w(L"Cc2");
- std::wstring upper_w = StringToUpperASCII(original_w);
- EXPECT_EQ(L"CC2", upper_w);
+ EXPECT_EQ("CC2", ToUpperASCII("Cc2"));
+ EXPECT_EQ(ASCIIToUTF16("CC2"), ToUpperASCII(ASCIIToUTF16("Cc2")));
}
TEST(StringUtilTest, LowerCaseEqualsASCII) {
« no previous file with comments | « base/strings/string_util.cc ('k') | chrome/browser/chromeos/input_method/input_method_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698