| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 void main() { | 7 void main() { |
| 6 // Normal modifiable list. | 8 // Normal modifiable list. |
| 7 var l1 = [0, 1, 2, 3, 4]; | 9 var l1 = [0, 1, 2, 3, 4]; |
| 8 | 10 |
| 9 bool checkedMode = false; | 11 bool checkedMode = false; |
| 10 assert(checkedMode = true); | 12 assert(checkedMode = true); |
| 11 | 13 |
| 12 // Index must be integer and in range. | 14 // Index must be integer and in range. |
| 13 Expect.throws(() { l1.insert(-1, 5); }, | 15 Expect.throws(() { l1.insert(-1, 5); }, |
| 14 (e) => e is RangeError, | 16 (e) => e is RangeError, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 42 Expect.throws(() { l3.insert(2, 5); }, | 44 Expect.throws(() { l3.insert(2, 5); }, |
| 43 (e) => e is UnsupportedError, | 45 (e) => e is UnsupportedError, |
| 44 "unmodifiable"); | 46 "unmodifiable"); |
| 45 | 47 |
| 46 // Empty list is not special. | 48 // Empty list is not special. |
| 47 var l4 = []; | 49 var l4 = []; |
| 48 l4.insert(0, 499); | 50 l4.insert(0, 499); |
| 49 Expect.equals(1, l4.length); | 51 Expect.equals(1, l4.length); |
| 50 Expect.equals(499, l4[0]); | 52 Expect.equals(499, l4[0]); |
| 51 } | 53 } |
| OLD | NEW |