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

Side by Side Diff: tests/corelib_strong/list_insert_all_test.dart

Issue 2989993002: fix unsound cast failures in tests (Closed)
Patch Set: fix 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
« no previous file with comments | « tests/corelib_strong/iterable_join_test.dart ('k') | tests/corelib_strong/sort_helper.dart » ('j') | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 test(List list, int index, Iterable iterable) { 8 test(List<int> list, int index, Iterable<int> iterable) {
9 List copy = list.toList(); 9 List copy = list.toList();
10 list.insertAll(index, iterable); 10 list.insertAll(index, iterable);
11 List iterableList = iterable.toList(); 11 List iterableList = iterable.toList();
12 Expect.equals(copy.length + iterableList.length, list.length); 12 Expect.equals(copy.length + iterableList.length, list.length);
13 for (int i = 0; i < index; i++) { 13 for (int i = 0; i < index; i++) {
14 Expect.equals(copy[i], list[i]); 14 Expect.equals(copy[i], list[i]);
15 } 15 }
16 for (int i = 0; i < iterableList.length; i++) { 16 for (int i = 0; i < iterableList.length; i++) {
17 Expect.equals(iterableList[i], list[i + index]); 17 Expect.equals(iterableList[i], list[i + index]);
18 } 18 }
19 for (int i = index + iterableList.length; i < copy.length; i++) { 19 for (int i = index + iterableList.length; i < copy.length; i++) {
20 Expect.equals(copy[i], list[i + iterableList.length]); 20 Expect.equals(copy[i], list[i + iterableList.length]);
21 } 21 }
22 } 22 }
23 23
24 class MyList extends ListBase { 24 class MyList<T> extends ListBase<T> {
25 List list; 25 List<T> list;
26 MyList(this.list); 26 MyList(this.list);
27 get length => list.length; 27 get length => list.length;
28 set length(value) { 28 set length(value) {
29 list.length = value; 29 list.length = value;
30 } 30 }
31 31
32 operator [](index) => list[index]; 32 operator [](index) => list[index];
33 operator []=(index, val) { 33 operator []=(index, val) {
34 list[index] = val; 34 list[index] = val;
35 } 35 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 expectUE(() => test([1, 2, 3].toList(growable: false), 0, [4, 5])); 81 expectUE(() => test([1, 2, 3].toList(growable: false), 0, [4, 5]));
82 } 82 }
83 83
84 void expectRE(void f()) { 84 void expectRE(void f()) {
85 Expect.throws(f, (e) => e is RangeError); 85 Expect.throws(f, (e) => e is RangeError);
86 } 86 }
87 87
88 void expectUE(void f()) { 88 void expectUE(void f()) {
89 Expect.throws(f, (e) => e is UnsupportedError); 89 Expect.throws(f, (e) => e is UnsupportedError);
90 } 90 }
OLDNEW
« no previous file with comments | « tests/corelib_strong/iterable_join_test.dart ('k') | tests/corelib_strong/sort_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698