OLD | NEW |
| (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 class SurrogatePairTest { | |
6 | |
7 static testMain() { | |
8 var monkeyFace = "🐵"; | |
9 var aceOfSpades = "🂡"; | |
10 var gronthismata = "𝁅"; | |
11 var segno = "𝄋"; | |
12 | |
13 Expect.equals(monkeyFace, monkeyFace.toUpperCase()); | |
14 Expect.equals(monkeyFace, monkeyFace.toLowerCase()); | |
15 Expect.equals(aceOfSpades, aceOfSpades.toUpperCase()); | |
16 Expect.equals(aceOfSpades, aceOfSpades.toLowerCase()); | |
17 Expect.equals(gronthismata, gronthismata.toUpperCase()); | |
18 Expect.equals(gronthismata, gronthismata.toLowerCase()); | |
19 Expect.equals(segno, segno.toUpperCase()); | |
20 Expect.equals(segno, segno.toLowerCase()); | |
21 | |
22 var mixedMitt = new String.fromCharCodes([0x10423, 0x1042e, 0x1043b]); | |
23 var upperMitt = new String.fromCharCodes([0x10423, 0x10406, 0x10413]); | |
24 var lowerMitt = new String.fromCharCodes([0x1044b, 0x1042e, 0x1043b]); | |
25 Expect.equals(upperMitt, mixedMitt.toUpperCase()); | |
26 Expect.equals(lowerMitt, mixedMitt.toLowerCase()); | |
27 Expect.equals(upperMitt, upperMitt.toUpperCase()); | |
28 Expect.equals(lowerMitt, upperMitt.toLowerCase()); | |
29 Expect.equals(upperMitt, lowerMitt.toUpperCase()); | |
30 Expect.equals(lowerMitt, lowerMitt.toLowerCase()); | |
31 | |
32 var mixedXMitt = new String.fromCharCodes([0x78, 0x10423, 0x1042e, 0x1043b])
; | |
33 var upperXMitt = new String.fromCharCodes([0X58, 0x10423, 0x10406, 0x10413])
; | |
34 var lowerXMitt = new String.fromCharCodes([0x78, 0x1044b, 0x1042e, 0x1043b])
; | |
35 Expect.equals(upperXMitt, mixedXMitt.toUpperCase()); | |
36 Expect.equals(lowerXMitt, mixedXMitt.toLowerCase()); | |
37 Expect.equals(upperXMitt, upperXMitt.toUpperCase()); | |
38 Expect.equals(lowerXMitt, upperXMitt.toLowerCase()); | |
39 Expect.equals(upperXMitt, lowerXMitt.toUpperCase()); | |
40 Expect.equals(lowerXMitt, lowerXMitt.toLowerCase()); | |
41 | |
42 var mixedDotMitt = new String.fromCharCodes([0x2e, 0x10423, 0x1042e, 0x1043b
]); | |
43 var upperDotMitt = new String.fromCharCodes([0X2e, 0x10423, 0x10406, 0x10413
]); | |
44 var lowerDotMitt = new String.fromCharCodes([0x2e, 0x1044b, 0x1042e, 0x1043b
]); | |
45 Expect.equals(upperDotMitt, mixedDotMitt.toUpperCase()); | |
46 Expect.equals(lowerDotMitt, mixedDotMitt.toLowerCase()); | |
47 Expect.equals(upperDotMitt, upperDotMitt.toUpperCase()); | |
48 Expect.equals(lowerDotMitt, upperDotMitt.toLowerCase()); | |
49 Expect.equals(upperDotMitt, lowerDotMitt.toUpperCase()); | |
50 Expect.equals(lowerDotMitt, lowerDotMitt.toLowerCase()); | |
51 | |
52 var lowerOw = new String.fromCharCodes([0x10435]); | |
53 var upperOw = new String.fromCharCodes([0x1040d]); | |
54 Expect.equals(lowerOw.codeUnitAt(1), monkeyFace.codeUnitAt(1)); | |
55 Expect.equals(upperOw, lowerOw.toUpperCase()); | |
56 Expect.equals(upperOw, upperOw.toUpperCase()); | |
57 Expect.equals(lowerOw, lowerOw.toLowerCase()); | |
58 Expect.equals(lowerOw, upperOw.toLowerCase()); | |
59 } | |
60 } | |
61 | |
62 main() { | |
63 SurrogatePairTest.testMain(); | |
64 } | |
OLD | NEW |