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

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

Issue 12328104: Change new List(n) to return fixed length list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head. Created 7 years, 9 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
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 void main() { 5 void main() {
6 // Normal modifiable list. 6 // Normal modifiable list.
7 var l1 = [0, 1, 2, 3, 4]; 7 var l1 = [0, 1, 2, 3, 4];
8 8
9 bool checkedMode = false; 9 bool checkedMode = false;
10 assert(checkedMode = true); 10 assert(checkedMode = true);
(...skipping 24 matching lines...) Expand all
35 Expect.equals(4, l1[3], "l1-1[3]"); 35 Expect.equals(4, l1[3], "l1-1[3]");
36 Expect.equals(4, l1.length, "length-1"); 36 Expect.equals(4, l1.length, "length-1");
37 37
38 Expect.equals(0, l1.removeAt(0), "l1-remove0"); 38 Expect.equals(0, l1.removeAt(0), "l1-remove0");
39 Expect.equals(1, l1[0], "l1-2[0]"); 39 Expect.equals(1, l1[0], "l1-2[0]");
40 Expect.equals(3, l1[1], "l1-2[1]"); 40 Expect.equals(3, l1[1], "l1-2[1]");
41 Expect.equals(4, l1[2], "l1-2[2]"); 41 Expect.equals(4, l1[2], "l1-2[2]");
42 Expect.equals(3, l1.length, "length-2"); 42 Expect.equals(3, l1.length, "length-2");
43 43
44 // Fixed size list. 44 // Fixed size list.
45 var l2 = new List.fixedLength(5); 45 var l2 = new List(5);
46 for (var i = 0; i < 5; i++) l2[i] = i; 46 for (var i = 0; i < 5; i++) l2[i] = i;
47 Expect.throws(() { l2.removeAt(2); }, 47 Expect.throws(() { l2.removeAt(2); },
48 (e) => e is UnsupportedError, 48 (e) => e is UnsupportedError,
49 "fixed-length"); 49 "fixed-length");
50 50
51 // Unmodifiable list. 51 // Unmodifiable list.
52 var l3 = const [0, 1, 2, 3, 4]; 52 var l3 = const [0, 1, 2, 3, 4];
53 Expect.throws(() { l3.removeAt(2); }, 53 Expect.throws(() { l3.removeAt(2); },
54 (e) => e is UnsupportedError, 54 (e) => e is UnsupportedError,
55 "unmodifiable"); 55 "unmodifiable");
56 56
57 // Empty list is not special. 57 // Empty list is not special.
58 var l4 = []; 58 var l4 = [];
59 Expect.throws(() { l4.removeAt(0); }, 59 Expect.throws(() { l4.removeAt(0); },
60 (e) => e is RangeError, 60 (e) => e is RangeError,
61 "empty"); 61 "empty");
62 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698