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

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

Issue 12041019: Remove List.filled constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove List.filled usage in serialization package. Created 7 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/core/list.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) 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 main() { 5 main() {
6 var a; 6 var a;
7 a = new List(); 7 a = new List();
8 a.add(499); 8 a.add(499);
9 Expect.equals(1, a.length); 9 Expect.equals(1, a.length);
10 Expect.equals(499, a[0]); 10 Expect.equals(499, a[0]);
(...skipping 15 matching lines...) Expand all
26 Expect.equals(42, a.length); 26 Expect.equals(42, a.length);
27 a.add(499); 27 a.add(499);
28 Expect.equals(43, a.length); 28 Expect.equals(43, a.length);
29 Expect.equals(499, a[42]); 29 Expect.equals(499, a[42]);
30 for (int i = 0; i < 42; i++) { 30 for (int i = 0; i < 42; i++) {
31 Expect.equals(null, a[i]); 31 Expect.equals(null, a[i]);
32 } 32 }
33 a.clear(); 33 a.clear();
34 Expect.equals(0, a.length); 34 Expect.equals(0, a.length);
35 Expect.throws(() => a[0], (e) => e is RangeError); 35 Expect.throws(() => a[0], (e) => e is RangeError);
36
37 a = new List.filled(42, -1);
38 Expect.equals(42, a.length);
39 a.add(499);
40 Expect.equals(43, a.length);
41 Expect.equals(499, a[42]);
42 for (int i = 0; i < 42; i++) {
43 Expect.equals(-1, a[i]);
44 }
45 a.clear();
46 Expect.equals(0, a.length);
47 Expect.throws(() => a[0], (e) => e is RangeError);
48
49 a = new List<int>.filled(42, -1);
50 Expect.equals(42, a.length);
51 a.add(499);
52 Expect.equals(43, a.length);
53 Expect.equals(499, a[42]);
54 for (int i = 0; i < 42; i++) {
55 Expect.equals(-1, a[i]);
56 }
57 a.clear();
58 Expect.equals(0, a.length);
59 Expect.throws(() => a[0], (e) => e is RangeError);
60 } 36 }
OLDNEW
« no previous file with comments | « sdk/lib/core/list.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698