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

Unified Diff: base/string_util_unittest.cc

Issue 28227: Add ToUpperASCII and StringToUpperASCII. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Use 2 instead of 1 in unit test to avoid confusion with small ell Created 11 years, 10 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/string_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/string_util_unittest.cc
===================================================================
--- base/string_util_unittest.cc (revision 10341)
+++ base/string_util_unittest.cc (working copy)
@@ -572,6 +572,32 @@
EXPECT_EQ(0, string_with_nul.compare(narrow_with_nul));
}
+TEST(StringUtilTest, ToUpperASCII) {
+ EXPECT_EQ('C', ToUpperASCII('C'));
+ EXPECT_EQ('C', ToUpperASCII('c'));
+ EXPECT_EQ('2', ToUpperASCII('2'));
+
+ EXPECT_EQ(L'C', ToUpperASCII(L'C'));
+ 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);
+}
+
static const struct {
const wchar_t* src_w;
const char* src_a;
« no previous file with comments | « base/string_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698