| Index: tests/lib_strong/typed_data/typed_data_list_test.dart
|
| diff --git a/tests/lib_strong/typed_data/typed_data_list_test.dart b/tests/lib_strong/typed_data/typed_data_list_test.dart
|
| index abdf73d2c49ec60dbb67f9ce5fe0a1612892a3fd..218079bfa14b532c59143a198e81142ab189acf4 100644
|
| --- a/tests/lib_strong/typed_data/typed_data_list_test.dart
|
| +++ b/tests/lib_strong/typed_data/typed_data_list_test.dart
|
| @@ -9,7 +9,8 @@ import 'package:expect/expect.dart';
|
| @NoInline()
|
| confuse(x) => x;
|
|
|
| -void testListFunctions/*<T>*/(list, first, last, /*=T*/ toElementType(dynamic x)) {
|
| +void testListFunctions/*<T>*/(
|
| + list, first, last, /*=T*/ toElementType(dynamic x)) {
|
| assert(list.length > 0);
|
|
|
| var reversed = list.reversed;
|
| @@ -28,21 +29,18 @@ void testListFunctions/*<T>*/(list, first, last, /*=T*/ toElementType(dynamic x)
|
| Expect.throws(() => list.addAll([one, two]), (e) => e is UnsupportedError);
|
| Expect.throws(() => list.clear(), (e) => e is UnsupportedError);
|
| Expect.throws(() => list.insert(0, zero), (e) => e is UnsupportedError);
|
| - Expect.throws(() => list.insertAll(0, [one, two]),
|
| - (e) => e is UnsupportedError);
|
| + Expect.throws(
|
| + () => list.insertAll(0, [one, two]), (e) => e is UnsupportedError);
|
| Expect.throws(() => list.remove(zero), (e) => e is UnsupportedError);
|
| Expect.throws(() => list.removeAt(0), (e) => e is UnsupportedError);
|
| Expect.throws(() => list.removeLast(), (e) => e is UnsupportedError);
|
| - Expect.throws(() => list.removeRange(0, 1),
|
| - (e) => e is UnsupportedError);
|
| - Expect.throws(() => list.removeWhere((x) => true),
|
| - (e) => e is UnsupportedError);
|
| - Expect.throws(() => list.replaceRange(0, 1, []),
|
| - (e) => e is UnsupportedError);
|
| - Expect.throws(() => list.retainWhere((x) => true),
|
| - (e) => e is UnsupportedError);
|
| -
|
| -
|
| + Expect.throws(() => list.removeRange(0, 1), (e) => e is UnsupportedError);
|
| + Expect.throws(
|
| + () => list.removeWhere((x) => true), (e) => e is UnsupportedError);
|
| + Expect.throws(
|
| + () => list.replaceRange(0, 1, []), (e) => e is UnsupportedError);
|
| + Expect.throws(
|
| + () => list.retainWhere((x) => true), (e) => e is UnsupportedError);
|
|
|
| var map = list.asMap();
|
| Expect.equals(list.length, map.length);
|
| @@ -73,8 +71,8 @@ void testListFunctions/*<T>*/(list, first, last, /*=T*/ toElementType(dynamic x)
|
| Expect.equals(0, list[i]);
|
| }
|
|
|
| - list.setAll(1,
|
| - list.getRange(1, list.length - 1).map((x) => toElementType(2)));
|
| + list.setAll(
|
| + 1, list.getRange(1, list.length - 1).map((x) => toElementType(2)));
|
| Expect.equals(copy.first, list.first);
|
| Expect.equals(copy.last, list.last);
|
| for (int i = 1; i < list.length - 1; i++) {
|
| @@ -82,26 +80,22 @@ void testListFunctions/*<T>*/(list, first, last, /*=T*/ toElementType(dynamic x)
|
| }
|
|
|
| list.setRange(1, list.length - 1,
|
| - new Iterable.generate(list.length - 2,
|
| - (x) => toElementType(x + 5)));
|
| + new Iterable.generate(list.length - 2, (x) => toElementType(x + 5)));
|
| Expect.equals(first, list.first);
|
| Expect.equals(last, list.last);
|
| for (int i = 1; i < list.length - 1; i++) {
|
| Expect.equals(4 + i, list[i]);
|
| }
|
| list.setRange(1, list.length - 1,
|
| - new Iterable.generate(list.length - 1,
|
| - (x) => toElementType(x + 5)),
|
| - 1);
|
| + new Iterable.generate(list.length - 1, (x) => toElementType(x + 5)), 1);
|
| Expect.equals(first, list.first);
|
| Expect.equals(last, list.last);
|
| for (int i = 1; i < list.length - 1; i++) {
|
| Expect.equals(5 + i, list[i]);
|
| }
|
|
|
| - Expect.throws(() => list.setRange(1, list.length - 1, []),
|
| - (e) => e is StateError);
|
| -
|
| + Expect.throws(
|
| + () => list.setRange(1, list.length - 1, []), (e) => e is StateError);
|
|
|
| for (int i = 0; i < list.length; i++) {
|
| list[list.length - 1 - i] = toElementType(i);
|
| @@ -112,7 +106,7 @@ void testListFunctions/*<T>*/(list, first, last, /*=T*/ toElementType(dynamic x)
|
| }
|
|
|
| Expect.listEquals(list.getRange(1, list.length - 1).toList(),
|
| - list.sublist(1, list.length - 1));
|
| + list.sublist(1, list.length - 1));
|
| Expect.listEquals(list.getRange(1, list.length).toList(), list.sublist(1));
|
| Expect.listEquals(list, list.sublist(0));
|
|
|
| @@ -120,12 +114,9 @@ void testListFunctions/*<T>*/(list, first, last, /*=T*/ toElementType(dynamic x)
|
| Expect.listEquals([], list.sublist(list.length));
|
| Expect.listEquals([], list.sublist(list.length, list.length));
|
|
|
| - Expect.throws(() => list.sublist(list.length + 1),
|
| - (e) => e is RangeError);
|
| - Expect.throws(() => list.sublist(0, list.length + 1),
|
| - (e) => e is RangeError);
|
| - Expect.throws(() => list.sublist(1, 0),
|
| - (e) => e is RangeError);
|
| + Expect.throws(() => list.sublist(list.length + 1), (e) => e is RangeError);
|
| + Expect.throws(() => list.sublist(0, list.length + 1), (e) => e is RangeError);
|
| + Expect.throws(() => list.sublist(1, 0), (e) => e is RangeError);
|
| }
|
|
|
| void emptyChecks/*<T>*/(list, /*=T*/ toElementType(dynamic c)) {
|
| @@ -144,19 +135,18 @@ void emptyChecks/*<T>*/(list, /*=T*/ toElementType(dynamic c)) {
|
| Expect.throws(() => list.addAll([one, two]), (e) => e is UnsupportedError);
|
| Expect.throws(() => list.clear(), (e) => e is UnsupportedError);
|
| Expect.throws(() => list.insert(0, zero), (e) => e is UnsupportedError);
|
| - Expect.throws(() => list.insertAll(0, [one, two]), (e) => e is UnsupportedError);
|
| + Expect.throws(
|
| + () => list.insertAll(0, [one, two]), (e) => e is UnsupportedError);
|
| Expect.throws(() => list.remove(zero), (e) => e is UnsupportedError);
|
| Expect.throws(() => list.removeAt(0), (e) => e is UnsupportedError);
|
| Expect.throws(() => list.removeLast(), (e) => e is UnsupportedError);
|
| Expect.throws(() => list.removeRange(0, 1), (e) => e is UnsupportedError);
|
| - Expect.throws(() => list.removeWhere((x) => true),
|
| - (e) => e is UnsupportedError);
|
| - Expect.throws(() => list.replaceRange(0, 1, []),
|
| - (e) => e is UnsupportedError);
|
| - Expect.throws(() => list.retainWhere((x) => true),
|
| - (e) => e is UnsupportedError);
|
| -
|
| -
|
| + Expect.throws(
|
| + () => list.removeWhere((x) => true), (e) => e is UnsupportedError);
|
| + Expect.throws(
|
| + () => list.replaceRange(0, 1, []), (e) => e is UnsupportedError);
|
| + Expect.throws(
|
| + () => list.retainWhere((x) => true), (e) => e is UnsupportedError);
|
|
|
| var map = list.asMap();
|
| Expect.equals(list.length, map.length);
|
| @@ -185,10 +175,10 @@ main() {
|
| double toDouble(x) => x.toDouble();
|
| int toInt(x) => x.toInt();
|
|
|
| - testListFunctions(new Float32List.fromList([1.5, 6.3, 9.5]),
|
| - 1.5, 9.5, toDouble);
|
| - testListFunctions(new Float64List.fromList([1.5, 6.3, 9.5]),
|
| - 1.5, 9.5, toDouble);
|
| + testListFunctions(
|
| + new Float32List.fromList([1.5, 6.3, 9.5]), 1.5, 9.5, toDouble);
|
| + testListFunctions(
|
| + new Float64List.fromList([1.5, 6.3, 9.5]), 1.5, 9.5, toDouble);
|
| testListFunctions(new Int8List.fromList([3, 5, 9]), 3, 9, toInt);
|
| testListFunctions(new Int16List.fromList([3, 5, 9]), 3, 9, toInt);
|
| testListFunctions(new Int32List.fromList([3, 5, 9]), 3, 9, toInt);
|
|
|