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

Side by Side Diff: tests/corelib/string_codeunits_test.dart

Issue 55533002: Fix some corelib tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor updates Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « tests/corelib/map_keys2_test.dart ('k') | 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 Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 main() { 7 main() {
8 test(String s) { 8 test(String s) {
9 Iterable<int> units = s.codeUnits; 9 List<int> units = s.codeUnits;
10 List<int> expectedUnits = <int>[]; 10 List<int> expectedUnits = <int>[];
11 for (int i = 0; i < s.length; i++) { 11 for (int i = 0; i < s.length; i++) {
12 expectedUnits.add(s.codeUnitAt(i)); 12 expectedUnits.add(s.codeUnitAt(i));
13 } 13 }
14 14
15 Expect.equals(s.length, units.length); 15 Expect.equals(s.length, units.length);
16 for (int i = 0; i < s.length; i++) { 16 for (int i = 0; i < s.length; i++) {
17 Expect.equals(s.codeUnitAt(i), units.elementAt(i)); 17 Expect.equals(s.codeUnitAt(i), units.elementAt(i));
18 } 18 }
19 19
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 test(string); 68 test(string);
69 69
70 // Reading each unit of a surrogate pair works. 70 // Reading each unit of a surrogate pair works.
71 var r = "\u{10000}".codeUnits; 71 var r = "\u{10000}".codeUnits;
72 var it = r.iterator; 72 var it = r.iterator;
73 Expect.isTrue(it.moveNext()); 73 Expect.isTrue(it.moveNext());
74 Expect.equals(0xD800, it.current); 74 Expect.equals(0xD800, it.current);
75 Expect.isTrue(it.moveNext()); 75 Expect.isTrue(it.moveNext());
76 Expect.equals(0xDC00, it.current); 76 Expect.equals(0xDC00, it.current);
77 } 77 }
OLDNEW
« no previous file with comments | « tests/corelib/map_keys2_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698