Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: tests/corelib/list_test.dart

Issue 1440663003: Add "growable" parameter to List.filled constructor. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/corelib/list_filled_type_argument_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « tests/corelib/list_filled_type_argument_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698