| 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 "dart:collection"; | 5 import "dart:collection"; |
| 6 import "dart:typed_data"; | 6 import "dart:typed_data"; |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 | 8 |
| 9 void main() { | 9 void main() { |
| 10 // Typed lists - fixed length and can only contain integers. | 10 // Typed lists - fixed length and can only contain integers. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 testFixedLengthList(new List(4).toList(growable: false)); | 26 testFixedLengthList(new List(4).toList(growable: false)); |
| 27 testFixedLengthList((new List()..length = 4).toList(growable: false)); | 27 testFixedLengthList((new List()..length = 4).toList(growable: false)); |
| 28 // ListBase implementation of List. | 28 // ListBase implementation of List. |
| 29 testFixedLengthList(new MyFixedList(new List(4))); | 29 testFixedLengthList(new MyFixedList(new List(4))); |
| 30 testFixedLengthList(new MyFixedList(new List(4)).toList(growable: false)); | 30 testFixedLengthList(new MyFixedList(new List(4)).toList(growable: false)); |
| 31 | 31 |
| 32 // Growable lists. Initial length 0. | 32 // Growable lists. Initial length 0. |
| 33 testGrowableList(new List()); | 33 testGrowableList(new List()); |
| 34 testGrowableList(new List().toList()); | 34 testGrowableList(new List().toList()); |
| 35 testGrowableList(new List(0).toList()); | 35 testGrowableList(new List(0).toList()); |
| 36 testGrowableList(new List.filled(0, null, growable: true)); |
| 36 testGrowableList([]); | 37 testGrowableList([]); |
| 37 testGrowableList((const []).toList()); | 38 testGrowableList((const []).toList()); |
| 38 testGrowableList(new MyList([])); | 39 testGrowableList(new MyList([])); |
| 39 testGrowableList(new MyList([]).toList()); | 40 testGrowableList(new MyList([]).toList()); |
| 40 | 41 |
| 41 testTypedGrowableList(new Uint8List(0).toList()); | 42 testTypedGrowableList(new Uint8List(0).toList()); |
| 42 testTypedGrowableList(new Int8List(0).toList()); | 43 testTypedGrowableList(new Int8List(0).toList()); |
| 43 testTypedGrowableList(new Uint16List(0).toList()); | 44 testTypedGrowableList(new Uint16List(0).toList()); |
| 44 testTypedGrowableList(new Int16List(0).toList()); | 45 testTypedGrowableList(new Int16List(0).toList()); |
| 45 testTypedGrowableList(new Uint32List(0).toList()); | 46 testTypedGrowableList(new Uint32List(0).toList()); |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 | 582 |
| 582 void testListConstructor() { | 583 void testListConstructor() { |
| 583 Expect.throws(() { new List(0).add(4); }); // Is fixed-length. | 584 Expect.throws(() { new List(0).add(4); }); // Is fixed-length. |
| 584 Expect.throws(() { new List(-2); }); // Not negative. /// 01: ok | 585 Expect.throws(() { new List(-2); }); // Not negative. /// 01: ok |
| 585 Expect.throws(() { new List(null); }); // Not null. | 586 Expect.throws(() { new List(null); }); // Not null. |
| 586 Expect.listEquals([4], new List()..add(4)); | 587 Expect.listEquals([4], new List()..add(4)); |
| 587 Expect.throws(() { new List.filled(0, 42).add(4); }); // Is fixed-length. | 588 Expect.throws(() { new List.filled(0, 42).add(4); }); // Is fixed-length. |
| 588 Expect.throws(() { new List.filled(-2, 42); }); // Not negative. | 589 Expect.throws(() { new List.filled(-2, 42); }); // Not negative. |
| 589 Expect.throws(() { new List.filled(null, 42); }); // Not null. | 590 Expect.throws(() { new List.filled(null, 42); }); // Not null. |
| 590 } | 591 } |
| OLD | NEW |