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

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

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 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
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, List<int> expectedRunes) { 8 test(String s, List<int> expectedRunes) {
9 Runes runes = s.runes; 9 Runes runes = s.runes;
10 Expect.identical(s, runes.string); 10 Expect.identical(s, runes.string);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // Reset, movePrevious. 50 // Reset, movePrevious.
51 it.reset(1); 51 it.reset(1);
52 Expect.equals(null, it.rawIndex); 52 Expect.equals(null, it.rawIndex);
53 Expect.equals(null, it.current); 53 Expect.equals(null, it.current);
54 it.movePrevious(); 54 it.movePrevious();
55 Expect.equals(0, it.rawIndex); 55 Expect.equals(0, it.rawIndex);
56 Expect.equals(expectedRunes[0], it.current); 56 Expect.equals(expectedRunes[0], it.current);
57 57
58 // .map 58 // .map
59 Expect.listEquals(expectedRunes.map((x) => x.toRadixString(16)).toList(), 59 Expect.listEquals(expectedRunes.map((x) => x.toRadixString(16)).toList(),
60 runes.map((x) => x.toRadixString(16)).toList()); 60 runes.map((x) => x.toRadixString(16)).toList());
61 } 61 }
62 62
63 // First character must be single-code-unit for test. 63 // First character must be single-code-unit for test.
64 test("abc", [0x61, 0x62, 0x63]); 64 test("abc", [0x61, 0x62, 0x63]);
65 test("\x00\u0000\u{000000}", [0, 0, 0]); 65 test("\x00\u0000\u{000000}", [0, 0, 0]);
66 test("\u{ffff}\u{10000}\u{10ffff}", [0xffff, 0x10000, 0x10ffff]); 66 test("\u{ffff}\u{10000}\u{10ffff}", [0xffff, 0x10000, 0x10ffff]);
67 String string = new String.fromCharCodes( 67 String string = new String.fromCharCodes(
68 [0xdc00, 0xd800, 61, 0xd800, 0xdc00, 62, 0xdc00, 0xd800]); 68 [0xdc00, 0xd800, 61, 0xd800, 0xdc00, 62, 0xdc00, 0xd800]);
69 test(string, [0xdc00, 0xd800, 61, 0x10000, 62, 0xdc00, 0xd800]); 69 test(string, [0xdc00, 0xd800, 61, 0x10000, 62, 0xdc00, 0xd800]);
70 70
71 // Setting position in the middle of a surrogate pair is not allowed. 71 // Setting position in the middle of a surrogate pair is not allowed.
72 var r = new Runes("\u{10000}"); 72 var r = new Runes("\u{10000}");
73 var it = r.iterator; 73 var it = r.iterator;
74 it.moveNext(); 74 it.moveNext();
75 Expect.equals(0x10000, it.current); 75 Expect.equals(0x10000, it.current);
76 76
77 // Setting rawIndex inside surrogate pair. 77 // Setting rawIndex inside surrogate pair.
78 Expect.throws(() { it.rawIndex = 1; }, (e) => e is Error); 78 Expect.throws(() {
79 Expect.throws(() { it.reset(1); }, (e) => e is Error); 79 it.rawIndex = 1;
80 }, (e) => e is Error);
81 Expect.throws(() {
82 it.reset(1);
83 }, (e) => e is Error);
80 } 84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698