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

Side by Side Diff: tests/corelib_strong/string_case_test.dart

Issue 2989473002: Migrated test block 27 to Dart 2.0. (Closed)
Patch Set: Addressed Bob's nits and fixed test failures Created 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "package:expect/expect.dart";
6
7 main() {
8 testLowerUpper();
9 testSpecialCases();
10 }
11
12 void testLowerUpper() {
13 var a = "Stop! Smell the Roses.";
14 var allLower = "stop! smell the roses.";
15 var allUpper = "STOP! SMELL THE ROSES.";
16 Expect.equals(allUpper, a.toUpperCase());
17 Expect.equals(allLower, a.toLowerCase());
18 }
19
20 void testSpecialCases() {
21 // Letters in Latin-1 where the upper case is not in Latin-1.
22
23 // German sharp s. Upper case variant is "SS".
24 Expect.equals("SS", "\xdf".toUpperCase()); // //# 01: ok
25 Expect.equals("\xdf", "\xdf".toLowerCase());
26 Expect.equals("ss", "\xdf".toUpperCase().toLowerCase()); // //# 01: continue d
27 // Micro sign (not same as lower-case Greek letter mu, U+03BC).
28 Expect.equals("\u039c", "\xb5".toUpperCase()); // //# 02: ok
29 Expect.equals("\xb5", "\xb5".toLowerCase());
30 Expect.equals("\u03Bc", // //# 02: continue d
31 "\xb5".toUpperCase().toLowerCase()); // //# 02: continue d
32 // Small letter y diaresis.
33 Expect.equals("\u0178", "\xff".toUpperCase()); // //# 03: ok
34 Expect.equals("\xff", "\xff".toLowerCase());
35 Expect.equals("\xff", "\xff".toUpperCase().toLowerCase()); // //# 03: continue d
36 // Zero.
37 Expect.equals("\x00", "\x00".toLowerCase());
38 Expect.equals("\x00", "\x00".toUpperCase());
39
40 // Test all combinations of ordering of lower-case, upper-case and
41 // special-when-upper-cased characters.
42 Expect.equals("AA\u0178", "Aa\xff".toUpperCase()); // //# 03: continue d
43 Expect.equals("AA\u0178", "aA\xff".toUpperCase()); // //# 03: continue d
44 Expect.equals("A\u0178A", "A\xffa".toUpperCase()); // //# 03: continue d
45 Expect.equals("A\u0178A", "a\xffA".toUpperCase()); // //# 03: continue d
46 Expect.equals("\u0178AA", "\xffAa".toUpperCase()); // //# 03: continue d
47 Expect.equals("\u0178AA", "\xffaA".toUpperCase()); // //# 03: continue d
48
49 Expect.equals("aa\xff", "Aa\xff".toLowerCase());
50 Expect.equals("aa\xff", "aA\xff".toLowerCase());
51 Expect.equals("a\xffa", "A\xffa".toLowerCase());
52 Expect.equals("a\xffa", "a\xffA".toLowerCase());
53 Expect.equals("\xffaa", "\xffAa".toLowerCase());
54 Expect.equals("\xffaa", "\xffaA".toLowerCase());
55 }
OLDNEW
« no previous file with comments | « tests/corelib_strong/string_buffer_test.dart ('k') | tests/corelib_strong/string_codeunits_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698