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