OLD | NEW |
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"; | |
6 | |
7 main() { | 5 main() { |
8 test(String s, List<int> expectedRunes) { | 6 test(String s, List<int> expectedRunes) { |
9 Runes runes = s.runes; | 7 Runes runes = s.runes; |
10 Expect.identical(s, runes.string); | 8 Expect.identical(s, runes.string); |
11 | 9 |
12 // for-in | 10 // for-in |
13 var res = []; | 11 var res = []; |
14 for (int rune in runes) { | 12 for (int rune in runes) { |
15 res.add(rune); | 13 res.add(rune); |
16 } | 14 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // Setting position in the middle of a surrogate pair is not allowed. | 69 // Setting position in the middle of a surrogate pair is not allowed. |
72 var r = new Runes("\u{10000}"); | 70 var r = new Runes("\u{10000}"); |
73 var it = r.iterator; | 71 var it = r.iterator; |
74 it.moveNext(); | 72 it.moveNext(); |
75 Expect.equals(0x10000, it.current); | 73 Expect.equals(0x10000, it.current); |
76 | 74 |
77 // Setting rawIndex inside surrogate pair. | 75 // Setting rawIndex inside surrogate pair. |
78 Expect.throws(() { it.rawIndex = 1; }, (e) => e is Error); | 76 Expect.throws(() { it.rawIndex = 1; }, (e) => e is Error); |
79 Expect.throws(() { it.reset(1); }, (e) => e is Error); | 77 Expect.throws(() { it.reset(1); }, (e) => e is Error); |
80 } | 78 } |
OLD | NEW |