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

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

Issue 2991363002: Migrated test block 14 to Dart 2.0. (Closed)
Patch Set: Migrated test block 14 to Dart 2.0. Created 3 years, 4 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
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 "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import 'dart:collection'; 6 import 'dart:collection';
7 7
8 class MyList extends ListBase { 8 class MyList extends ListBase {
9 List list; 9 List list;
10 MyList(this.list); 10 MyList(this.list);
(...skipping 14 matching lines...) Expand all
25 // Index must be integer and in range. 25 // Index must be integer and in range.
26 Expect.throws(() { 26 Expect.throws(() {
27 l1.removeAt(-1); 27 l1.removeAt(-1);
28 }, (e) => e is RangeError, "negative"); 28 }, (e) => e is RangeError, "negative");
29 Expect.throws(() { 29 Expect.throws(() {
30 l1.removeAt(5); 30 l1.removeAt(5);
31 }, (e) => e is RangeError, "too large"); 31 }, (e) => e is RangeError, "too large");
32 Expect.throws(() { 32 Expect.throws(() {
33 l1.removeAt(null); 33 l1.removeAt(null);
34 }, (e) => e is ArgumentError, "too large"); 34 }, (e) => e is ArgumentError, "too large");
35 Expect.throws(() {
36 l1.removeAt("1");
37 }, (e) => (typeAssertionsEnabled ? e is TypeError : e is ArgumentError),
38 "string");
39 Expect.throws(() {
40 l1.removeAt(1.5);
41 }, (e) => (typeAssertionsEnabled ? e is TypeError : e is ArgumentError),
42 "double");
Bob Nystrom 2017/08/03 20:22:25 Woo!
43 35
44 Expect.equals(2, l1.removeAt(2), "l1-remove2"); 36 Expect.equals(2, l1.removeAt(2), "l1-remove2");
45 Expect.equals(1, l1[1], "l1-1[1]"); 37 Expect.equals(1, l1[1], "l1-1[1]");
46 38
47 Expect.equals(3, l1[2], "l1-1[2]"); 39 Expect.equals(3, l1[2], "l1-1[2]");
48 Expect.equals(4, l1[3], "l1-1[3]"); 40 Expect.equals(4, l1[3], "l1-1[3]");
49 Expect.equals(4, l1.length, "length-1"); 41 Expect.equals(4, l1.length, "length-1");
50 42
51 Expect.equals(0, l1.removeAt(0), "l1-remove0"); 43 Expect.equals(0, l1.removeAt(0), "l1-remove0");
52 Expect.equals(1, l1[0], "l1-2[0]"); 44 Expect.equals(1, l1[0], "l1-2[0]");
(...skipping 19 matching lines...) Expand all
72 Expect.throws(() { 64 Expect.throws(() {
73 l3.removeAt(2); 65 l3.removeAt(2);
74 }, (e) => e is UnsupportedError, "unmodifiable"); 66 }, (e) => e is UnsupportedError, "unmodifiable");
75 67
76 // Empty list is not special. 68 // Empty list is not special.
77 var l4 = []; 69 var l4 = [];
78 Expect.throws(() { 70 Expect.throws(() {
79 l4.removeAt(0); 71 l4.removeAt(0);
80 }, (e) => e is RangeError, "empty"); 72 }, (e) => e is RangeError, "empty");
81 } 73 }
OLDNEW
« no previous file with comments | « tests/corelib_2/list_remove_range_test.dart ('k') | tests/corelib_2/list_replace_range_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698