OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 var a; | 6 var a; |
9 a = new List(); | 7 a = new List(); |
10 a.add(499); | 8 a.add(499); |
11 Expect.equals(1, a.length); | 9 Expect.equals(1, a.length); |
12 Expect.equals(499, a[0]); | 10 Expect.equals(499, a[0]); |
13 a.clear(); | 11 a.clear(); |
14 Expect.equals(0, a.length); | 12 Expect.equals(0, a.length); |
15 Expect.throws(() => a[0], (e) => e is RangeError); | 13 Expect.throws(() => a[0], (e) => e is RangeError); |
16 | 14 |
(...skipping 12 matching lines...) Expand all Loading... |
29 a.add(499); | 27 a.add(499); |
30 Expect.equals(43, a.length); | 28 Expect.equals(43, a.length); |
31 Expect.equals(499, a[42]); | 29 Expect.equals(499, a[42]); |
32 for (int i = 0; i < 42; i++) { | 30 for (int i = 0; i < 42; i++) { |
33 Expect.equals(null, a[i]); | 31 Expect.equals(null, a[i]); |
34 } | 32 } |
35 a.clear(); | 33 a.clear(); |
36 Expect.equals(0, a.length); | 34 Expect.equals(0, a.length); |
37 Expect.throws(() => a[0], (e) => e is RangeError); | 35 Expect.throws(() => a[0], (e) => e is RangeError); |
38 } | 36 } |
OLD | NEW |