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

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

Issue 10989013: Change IllegalArgumentException to ArgumentError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated co19 test expectations. Created 8 years, 2 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);
11 11
12 // Index must be integer and in range. 12 // Index must be integer and in range.
13 Expect.throws(() { l1.removeAt(-1); }, 13 Expect.throws(() { l1.removeAt(-1); },
14 (e) => e is IndexOutOfRangeException, 14 (e) => e is IndexOutOfRangeException,
15 "negative"); 15 "negative");
16 Expect.throws(() { l1.removeAt(5); }, 16 Expect.throws(() { l1.removeAt(5); },
17 (e) => e is IndexOutOfRangeException, 17 (e) => e is IndexOutOfRangeException,
18 "too large"); 18 "too large");
19 Expect.throws(() { l1.removeAt(null); }, 19 Expect.throws(() { l1.removeAt(null); },
20 (e) => e is IllegalArgumentException, 20 (e) => e is ArgumentError,
21 "too large"); 21 "too large");
22 Expect.throws(() { l1.removeAt("1"); }, 22 Expect.throws(() { l1.removeAt("1"); },
23 (e) => (checkedMode ? e is TypeError 23 (e) => (checkedMode ? e is TypeError
24 : e is IllegalArgumentException), 24 : e is ArgumentError),
25 "string"); 25 "string");
26 Expect.throws(() { l1.removeAt(1.5); }, 26 Expect.throws(() { l1.removeAt(1.5); },
27 (e) => (checkedMode ? e is TypeError 27 (e) => (checkedMode ? e is TypeError
28 : e is IllegalArgumentException), 28 : e is ArgumentError),
29 "double"); 29 "double");
30 30
31 Expect.equals(2, l1.removeAt(2), "l1-remove2"); 31 Expect.equals(2, l1.removeAt(2), "l1-remove2");
32 Expect.equals(1, l1[1], "l1-1[1]"); 32 Expect.equals(1, l1[1], "l1-1[1]");
33 33
34 Expect.equals(3, l1[2], "l1-1[2]"); 34 Expect.equals(3, l1[2], "l1-1[2]");
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");
(...skipping 14 matching lines...) Expand all
53 Expect.throws(() { l3.removeAt(2); }, 53 Expect.throws(() { l3.removeAt(2); },
54 (e) => e is UnsupportedOperationException, 54 (e) => e is UnsupportedOperationException,
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 IndexOutOfRangeException, 60 (e) => e is IndexOutOfRangeException,
61 "empty"); 61 "empty");
62 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698