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

Side by Side Diff: base/i18n/case_conversion_unittest.cc

Issue 1104483002: added test to test case converting with nonASCII (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/i18n/case_conversion.h" 5 #include "base/i18n/case_conversion.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace base { 9 namespace base {
10 namespace { 10 namespace {
11 11
12 // Test upper and lower case string conversion. 12 // Test upper and lower case string conversion.
13 TEST(CaseConversionTest, UpperLower) { 13 TEST(CaseConversionTest, UpperLower) {
14 string16 mixed(ASCIIToUTF16("Text with UPPer & lowER casE.")); 14 string16 mixed(ASCIIToUTF16("Text with UPPer & lowER casE."));
15 const string16 expected_lower(ASCIIToUTF16("text with upper & lower case.")); 15 const string16 expected_lower(ASCIIToUTF16("text with upper & lower case."));
16 const string16 expected_upper(ASCIIToUTF16("TEXT WITH UPPER & LOWER CASE.")); 16 const string16 expected_upper(ASCIIToUTF16("TEXT WITH UPPER & LOWER CASE."));
17 17
18 string16 result = base::i18n::ToLower(mixed); 18 string16 result = base::i18n::ToLower(mixed);
19 EXPECT_EQ(expected_lower, result); 19 EXPECT_EQ(expected_lower, result);
20 20
21 result = base::i18n::ToUpper(mixed); 21 result = base::i18n::ToUpper(mixed);
22 EXPECT_EQ(expected_upper, result); 22 EXPECT_EQ(expected_upper, result);
23 } 23 }
24 24
25 // TODO(jshin): More tests are needed, especially with non-ASCII characters. 25 TEST(CaseConversionTest, nonASCII) {
26 string16 mixed(UTF8ToUTF16(u8"ÄÖäö Ïï ÷%¤#*^`@£$‰‚~ ἇἏ Ḁḁ"));
jungshik at Google 2015/04/27 18:25:51 MSVC does not support 'u8', yet, IIRC. It cannot e
27 const string16 expected_lower(UTF8ToUTF16(u8"äöäö ïï ÷%¤#*^`@£$‰‚~ ἇἇ ḁḁ"));
jungshik at Google 2015/04/27 18:25:51 Add a test with Turkish dotless i and try case con
28 const string16 expected_upper(UTF8ToUTF16(u8"ÄÖÄÖ ÏÏ ÷%¤#*^`@£$‰‚~ ἏἏ ḀḀ"));
29
30 string16 result = base::i18n::ToLower(mixed);
31 EXPECT_EQ(expected_lower, result);
32
33 result = base::i18n::ToUpper(mixed);
34 EXPECT_EQ(expected_upper, result);
35 }
26 36
27 } // namespace 37 } // namespace
28 } // namespace base 38 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698