Fixes #898: LibTest\typed_data\Int64List tests adopted for null safety.
diff --git a/LibTest/typed_data/Int64List/Int64List.view_A05_t01.dart b/LibTest/typed_data/Int64List/Int64List.view_A05_t01.dart
index ca61e5c..a8842ad 100644
--- a/LibTest/typed_data/Int64List/Int64List.view_A05_t01.dart
+++ b/LibTest/typed_data/Int64List/Int64List.view_A05_t01.dart
@@ -25,11 +25,8 @@
void check(List<int> array, int offset) {
var tmp = new Int64List.fromList(array);
var byteBuffer = tmp.buffer;
- try {
- new Int64List.view(byteBuffer, offset);
- Expect.fail("RangeError exception is expected");
- } on RangeError {
- }
+ Expect.throws(
+ () { Int64List.view(byteBuffer, offset); }, (e) => e is RangeError);
}
main() {
diff --git a/LibTest/typed_data/Int64List/Int64List.view_A05_t02.dart b/LibTest/typed_data/Int64List/Int64List.view_A05_t02.dart
index 8de1de5..ce359dd 100644
--- a/LibTest/typed_data/Int64List/Int64List.view_A05_t02.dart
+++ b/LibTest/typed_data/Int64List/Int64List.view_A05_t02.dart
@@ -24,11 +24,8 @@
void check(List<int> array, int offset, int length) {
var tmp = new Int64List.fromList(array);
var byteBuffer = tmp.buffer;
- try {
- new Int64List.view(byteBuffer, offset, length);
- Expect.fail("RangeError exception is expected");
- } on RangeError {
- }
+ Expect.throws(() { Int64List.view(byteBuffer, offset, length); },
+ (e) => e is RangeError);
}
main() {
diff --git a/LibTest/typed_data/Int64List/Int64List.view_A05_t03.dart b/LibTest/typed_data/Int64List/Int64List.view_A05_t03.dart
index a48b554..5e0581c 100644
--- a/LibTest/typed_data/Int64List/Int64List.view_A05_t03.dart
+++ b/LibTest/typed_data/Int64List/Int64List.view_A05_t03.dart
@@ -25,11 +25,8 @@
void check(List<int> array, int offset, int length) {
var tmp = new Int64List.fromList(array);
var byteBuffer = tmp.buffer;
- try {
- new Int64List.view(byteBuffer, offset, length);
- Expect.fail("RangeError exception is expected");
- } on RangeError {
- }
+ Expect.throws(() { Int64List.view(byteBuffer, offset, length); },
+ (e) => e is RangeError);
}
main() {
diff --git a/LibTest/typed_data/Int64List/Int64List.view_A06_t01.dart b/LibTest/typed_data/Int64List/Int64List.view_A06_t01.dart
index eddee8b..9f3eeaa 100644
--- a/LibTest/typed_data/Int64List/Int64List.view_A06_t01.dart
+++ b/LibTest/typed_data/Int64List/Int64List.view_A06_t01.dart
@@ -13,8 +13,8 @@
* ...
* Throws [ArgumentError] if [offsetInBytes] is not a multiple of
* BYTES_PER_ELEMENT.
- * @description Checks that [ArgumentError] is thrown if [offsetInBytes] is
- * not a multiple of BYTES_PER_ELEMENT.
+ * @description Checks that [ArgumentError] is thrown if [offsetInBytes] is not
+ * a multiple of BYTES_PER_ELEMENT.
* @author msyabro
*/
@@ -25,9 +25,6 @@
var list = new Int64List(2);
var buffer = list.buffer;
for (int i = 1; i < Int64List.bytesPerElement; ++i) {
- try {
- new Int64List.view(buffer, i);
- Expect.fail("ArgumentError is expected");
- } on ArgumentError {}
+ Expect.throws(() { Int64List.view(buffer, i); }, (e) => e is ArgumentError);
}
}
diff --git a/LibTest/typed_data/Int64List/addAll_A01_t01.dart b/LibTest/typed_data/Int64List/addAll_A01_t01.dart
index 75451b2..397f120 100644
--- a/LibTest/typed_data/Int64List/addAll_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/addAll_A01_t01.dart
@@ -18,10 +18,7 @@
check(length) {
var l = new Int64List(length);
- try {
- l.addAll([]);
- Expect.fail("This operation should not be supported");
- } on UnsupportedError {}
+ Expect.throws(() { l.addAll([]); }, (e) => e is UnsupportedError);
Expect.equals(length, l.length);
}
diff --git a/LibTest/typed_data/Int64List/add_A01_t01.dart b/LibTest/typed_data/Int64List/add_A01_t01.dart
index 431e8f0..b55a7db 100644
--- a/LibTest/typed_data/Int64List/add_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/add_A01_t01.dart
@@ -17,10 +17,7 @@
check(length) {
var l = new Int64List(length);
- try {
- l.add(0);
- Expect.fail("This operation should not be supported");
- } on UnsupportedError {}
+ Expect.throws(() { l.add(0); }, (e) => e is UnsupportedError);
Expect.equals(length, l.length);
}
diff --git a/LibTest/typed_data/Int64List/buffer_A01_t02.dart b/LibTest/typed_data/Int64List/buffer_A01_t02.dart
index cdd5aad..731f363 100644
--- a/LibTest/typed_data/Int64List/buffer_A01_t02.dart
+++ b/LibTest/typed_data/Int64List/buffer_A01_t02.dart
@@ -15,10 +15,8 @@
void check(List<int> array) {
dynamic l = new Int64List.fromList(array);
- try {
- l.buffer = new Int64List.fromList(array).buffer;
- Expect.fail("[buffer] should be read-only");
- } on NoSuchMethodError {}
+ Expect.throws(() { l.buffer = new Int64List.fromList(array).buffer; },
+ (e) => e is NoSuchMethodError);
}
main() {
diff --git a/LibTest/typed_data/Int64List/clear_A01_t01.dart b/LibTest/typed_data/Int64List/clear_A01_t01.dart
index 67d27b5..dc63e7b 100644
--- a/LibTest/typed_data/Int64List/clear_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/clear_A01_t01.dart
@@ -18,10 +18,7 @@
check(length) {
var l = new Int64List(length);
- try {
- l.clear();
- Expect.fail("This operation should not be supported");
- } on UnsupportedError {}
+ Expect.throws(() { l.clear(); }, (e) => e is UnsupportedError);
Expect.equals(length, l.length);
}
diff --git a/LibTest/typed_data/Int64List/elementAt_A02_t01.dart b/LibTest/typed_data/Int64List/elementAt_A02_t01.dart
index ee342ab..19352cc 100644
--- a/LibTest/typed_data/Int64List/elementAt_A02_t01.dart
+++ b/LibTest/typed_data/Int64List/elementAt_A02_t01.dart
@@ -19,18 +19,9 @@
check(length) {
var l = new Int64List(length);
- try {
- l.elementAt(length + 1);
- Expect.fail("RangeError is expected");
- } on RangeError {}
- try {
- l.elementAt(-1);
- Expect.fail("RangeError is expected");
- } on RangeError {}
- try {
- l.elementAt(length);
- Expect.fail("RangeError is expected");
- } on RangeError {}
+ Expect.throws(() { l.elementAt(length + 1); }, (e) => e is RangeError);
+ Expect.throws(() { l.elementAt(length ); }, (e) => e is RangeError);
+ Expect.throws(() { l.elementAt(-1 ); }, (e) => e is RangeError);
}
main() {
diff --git a/LibTest/typed_data/Int64List/elementSizeInBytes_A01_t02.dart b/LibTest/typed_data/Int64List/elementSizeInBytes_A01_t02.dart
index 15770f8..8e3257f 100644
--- a/LibTest/typed_data/Int64List/elementSizeInBytes_A01_t02.dart
+++ b/LibTest/typed_data/Int64List/elementSizeInBytes_A01_t02.dart
@@ -16,8 +16,5 @@
main() {
dynamic l = new Int64List(0);
- try {
- l.elementSizeInBytes = 2;
- Expect.fail("[elementSizeInBytes] should be read-only");
- } on NoSuchMethodError {}
+ Expect.throws(() { l.elementSizeInBytes = 2; }, (e) => e is NoSuchMethodError);
}
diff --git a/LibTest/typed_data/Int64List/firstWhere_A03_t01.dart b/LibTest/typed_data/Int64List/firstWhere_A03_t01.dart
index d0d4476..7739784 100644
--- a/LibTest/typed_data/Int64List/firstWhere_A03_t01.dart
+++ b/LibTest/typed_data/Int64List/firstWhere_A03_t01.dart
@@ -17,10 +17,7 @@
check(List<int> list) {
var l = new Int64List.fromList(list);
- try {
- l.firstWhere((e) => false);
- Expect.fail("StateError is expected");
- } on StateError {}
+ Expect.throws(() { l.firstWhere((e) => false); }, (e) => e is StateError);
}
main() {
diff --git a/LibTest/typed_data/Int64List/first_A02_t01.dart b/LibTest/typed_data/Int64List/first_A02_t01.dart
index 565d91b..584a13e 100644
--- a/LibTest/typed_data/Int64List/first_A02_t01.dart
+++ b/LibTest/typed_data/Int64List/first_A02_t01.dart
@@ -15,8 +15,5 @@
main() {
var l = new Int64List.fromList([]);
- try {
- l.first;
- Expect.fail("StateError is expected");
- } on StateError {}
+ Expect.throws(() { l.first; }, (e) => e is StateError);
}
diff --git a/LibTest/typed_data/Int64List/fold_A01_t01.dart b/LibTest/typed_data/Int64List/fold_A01_t01.dart
index cc7713c..558be48 100644
--- a/LibTest/typed_data/Int64List/fold_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/fold_A01_t01.dart
@@ -19,7 +19,7 @@
checkInt(List<int> list, int expected) {
var l = new Int64List.fromList(list);
- var res = l.fold(0, (prev, cur) => prev + cur);
+ var res = l.fold(0, (num prev, num cur) => prev + cur);
Expect.equals(expected, res);
}
diff --git a/LibTest/typed_data/Int64List/hashCode_A01_t01.dart b/LibTest/typed_data/Int64List/hashCode_A01_t01.dart
index c2cc678..5c8a79b 100644
--- a/LibTest/typed_data/Int64List/hashCode_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/hashCode_A01_t01.dart
@@ -19,7 +19,6 @@
import "dart:typed_data";
import "../../../Utils/expect.dart";
-
main() {
var obj1 = new Int64List(0);
var obj2 = new Int64List(0);
diff --git a/LibTest/typed_data/Int64List/hashCode_A01_t02.dart b/LibTest/typed_data/Int64List/hashCode_A01_t02.dart
index cba15b4..925b5a7 100644
--- a/LibTest/typed_data/Int64List/hashCode_A01_t02.dart
+++ b/LibTest/typed_data/Int64List/hashCode_A01_t02.dart
@@ -18,7 +18,6 @@
import "dart:typed_data";
import "../../../Utils/expect.dart";
-
main() {
dynamic list = new Int64List(0);
try {
diff --git a/LibTest/typed_data/Int64List/insertAll_A01_t01.dart b/LibTest/typed_data/Int64List/insertAll_A01_t01.dart
index a210114..1ee8a61 100644
--- a/LibTest/typed_data/Int64List/insertAll_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/insertAll_A01_t01.dart
@@ -20,16 +20,10 @@
main() {
var l = new Int64List(10);
- try {
- l.insertAll(0, [1, 2, 3]);
- Expect.fail("UnsupportedError is expected");
- } on UnsupportedError {}
+ Expect.throws(() { l.insertAll(0, [1, 2, 3]); }, (e) => e is UnsupportedError);
Expect.equals(10, l.length);
l = new Int64List(0);
- try {
- l.insertAll(0, [1, 1, 1]);
- Expect.fail("UnsupportedError is expected");
- } on UnsupportedError {}
+ Expect.throws(() { l.insertAll(0, [1, 1, 1]); }, (e) => e is UnsupportedError);
Expect.equals(0, l.length);
}
diff --git a/LibTest/typed_data/Int64List/insert_A01_t01.dart b/LibTest/typed_data/Int64List/insert_A01_t01.dart
index b44f6c9..ec89a4f 100644
--- a/LibTest/typed_data/Int64List/insert_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/insert_A01_t01.dart
@@ -20,16 +20,10 @@
main() {
var l = new Int64List(10);
- try {
- l.insert(0, 0);
- Expect.fail("UnsupportedError is expected");
- } on UnsupportedError {}
+ Expect.throws(() { l.insert(0, 0); }, (e) => e is UnsupportedError);
Expect.equals(10, l.length);
l = new Int64List(0);
- try {
- l.insert(0, 0);
- Expect.fail("UnsupportedError is expected");
- } on UnsupportedError {}
+ Expect.throws(() { l.insert(0, 0); }, (e) => e is UnsupportedError);
Expect.equals(0, l.length);
}
diff --git a/LibTest/typed_data/Int64List/isEmpty_A01_t02.dart b/LibTest/typed_data/Int64List/isEmpty_A01_t02.dart
index dba7aad..e591b11 100644
--- a/LibTest/typed_data/Int64List/isEmpty_A01_t02.dart
+++ b/LibTest/typed_data/Int64List/isEmpty_A01_t02.dart
@@ -15,9 +15,5 @@
main() {
dynamic l = new Int64List(0);
-
- try {
- l.isEmpty = false;
- Expect.fail("[isEmpty] should be read-only");
- } on NoSuchMethodError {}
+ Expect.throws(() { l.isEmpty = false; }, (e) => e is NoSuchMethodError);
}
diff --git a/LibTest/typed_data/Int64List/isNotEmpty_A01_t02.dart b/LibTest/typed_data/Int64List/isNotEmpty_A01_t02.dart
index 761ae53..fe6729a 100644
--- a/LibTest/typed_data/Int64List/isNotEmpty_A01_t02.dart
+++ b/LibTest/typed_data/Int64List/isNotEmpty_A01_t02.dart
@@ -15,9 +15,5 @@
main() {
dynamic l = new Int64List(0);
-
- try {
- l.isNotEmpty = false;
- Expect.fail("[isNotEmpty] should be read-only");
- } on NoSuchMethodError {}
+ Expect.throws(() { l.isNotEmpty = false; }, (e) => e is NoSuchMethodError);
}
diff --git a/LibTest/typed_data/Int64List/iterator_A01_t01.dart b/LibTest/typed_data/Int64List/iterator_A01_t01.dart
index 704e1aa..8639e2b 100644
--- a/LibTest/typed_data/Int64List/iterator_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/iterator_A01_t01.dart
@@ -29,7 +29,7 @@
checkIterator([]);
checkIterator([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
- var a = new List<int>(255);
+ var a = List<int>.filled(255, 0);
for (var i = 0; i < a.length; i++) {
a[i] = i;
}
diff --git a/LibTest/typed_data/Int64List/iterator_A01_t02.dart b/LibTest/typed_data/Int64List/iterator_A01_t02.dart
index 7d0517b..cd8019c 100644
--- a/LibTest/typed_data/Int64List/iterator_A01_t02.dart
+++ b/LibTest/typed_data/Int64List/iterator_A01_t02.dart
@@ -16,8 +16,5 @@
main() {
dynamic l = new Int64List.fromList([0]);
- try {
- l.iterator = l.iterator;
- Expect.fail("[iterator] should be read-only");
- } on NoSuchMethodError {}
+ Expect.throws(() { l.iterator = l.iterator; }, (e) => e is NoSuchMethodError);
}
diff --git a/LibTest/typed_data/Int64List/iterator_current_A01_t01.dart b/LibTest/typed_data/Int64List/iterator_current_A01_t01.dart
index 8186f44..5e28a30 100644
--- a/LibTest/typed_data/Int64List/iterator_current_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/iterator_current_A01_t01.dart
@@ -26,7 +26,7 @@
checkNext([1]);
checkNext([1, 2, 3]);
- var a = new List<int>(255);
+ var a = List<int>.filled(255, 1);
for (var i = 0; i < a.length; i++) {
a[i] = a.length - i;
}
diff --git a/LibTest/typed_data/Int64List/lastWhere_A03_t01.dart b/LibTest/typed_data/Int64List/lastWhere_A03_t01.dart
index b9a636b..4fada65 100644
--- a/LibTest/typed_data/Int64List/lastWhere_A03_t01.dart
+++ b/LibTest/typed_data/Int64List/lastWhere_A03_t01.dart
@@ -17,10 +17,7 @@
check(List<int> list) {
var l = new Int64List.fromList(list);
- try {
- l.lastWhere((e) => false);
- Expect.fail("StateError is expected");
- } on StateError {}
+ Expect.throws(() { l.lastWhere((e) => false); }, (e) => e is StateError);
}
main() {
diff --git a/LibTest/typed_data/Int64List/last_A02_t01.dart b/LibTest/typed_data/Int64List/last_A02_t01.dart
index 3b56397..94a6bf4 100644
--- a/LibTest/typed_data/Int64List/last_A02_t01.dart
+++ b/LibTest/typed_data/Int64List/last_A02_t01.dart
@@ -16,8 +16,5 @@
main() {
var l = new Int64List.fromList([]);
- try {
- l.last;
- Expect.fail("StateError is expected");
- } on StateError {}
+ Expect.throws(() { l.last; }, (e) => e is StateError);
}
diff --git a/LibTest/typed_data/Int64List/lengthInBytes_A01_t02.dart b/LibTest/typed_data/Int64List/lengthInBytes_A01_t02.dart
index 5b81ae2..97bb8e2 100644
--- a/LibTest/typed_data/Int64List/lengthInBytes_A01_t02.dart
+++ b/LibTest/typed_data/Int64List/lengthInBytes_A01_t02.dart
@@ -15,10 +15,7 @@
void check(List<int> list) {
dynamic l = new Int64List.fromList(list);
- try {
- l.lengthInBytes = 0;
- Expect.fail("[lengthInBytes] should be read-only");
- } on NoSuchMethodError {}
+ Expect.throws(() { l.lengthInBytes = 0; }, (e) => e is NoSuchMethodError);
}
main() {
diff --git a/LibTest/typed_data/Int64List/length_A02_t01.dart b/LibTest/typed_data/Int64List/length_A02_t01.dart
index c2ac938..c19576b 100644
--- a/LibTest/typed_data/Int64List/length_A02_t01.dart
+++ b/LibTest/typed_data/Int64List/length_A02_t01.dart
@@ -18,10 +18,7 @@
void check(List<int> array, int length) {
dynamic l = new Int64List.fromList(array);
- try {
- l.length = 1;
- Expect.fail("This operation should not be supported");
- } on UnsupportedError {}
+ Expect.throws(() { l.length = 1; }, (e) => e is UnsupportedError);
Expect.equals(length, l.length);
}
diff --git a/LibTest/typed_data/Int64List/offsetInBytes_A01_t02.dart b/LibTest/typed_data/Int64List/offsetInBytes_A01_t02.dart
index 92239d7..3ed9af2 100644
--- a/LibTest/typed_data/Int64List/offsetInBytes_A01_t02.dart
+++ b/LibTest/typed_data/Int64List/offsetInBytes_A01_t02.dart
@@ -15,10 +15,7 @@
void check(List<int> array) {
dynamic l = new Int64List.fromList(array);
- try {
- l.offsetInBytes = 0;
- Expect.fail("[offsetInBytes] should be read-only");
- } on NoSuchMethodError {}
+ Expect.throws(() { l.offsetInBytes = 0; }, (e) => e is NoSuchMethodError);
}
main() {
diff --git a/LibTest/typed_data/Int64List/operator_subscript_A01_t01.dart b/LibTest/typed_data/Int64List/operator_subscript_A01_t01.dart
index 0cad9c3..7511f97 100644
--- a/LibTest/typed_data/Int64List/operator_subscript_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/operator_subscript_A01_t01.dart
@@ -23,7 +23,7 @@
main() {
check([]);
check([1]);
- var list = new List<int>(255);
+ var list = List<int>.filled(255, 0);
for (int i = 0; i < 255; ++i) {
list[i] = i;
}
diff --git a/LibTest/typed_data/Int64List/operator_subscript_A02_t01.dart b/LibTest/typed_data/Int64List/operator_subscript_A02_t01.dart
index 72f6ed1..0c63e6e 100644
--- a/LibTest/typed_data/Int64List/operator_subscript_A02_t01.dart
+++ b/LibTest/typed_data/Int64List/operator_subscript_A02_t01.dart
@@ -16,28 +16,16 @@
check(List<int> list) {
var l = new Int64List.fromList(list);
- try {
- l[-1];
- Expect.fail("RangeError is expected");
- } on RangeError {}
- try {
- l[l.length];
- Expect.fail("RangeError is expected");
- } on RangeError {}
- try {
- l[0x80000000];
- Expect.fail("RangeError is expected");
- } on RangeError {}
- try {
- l[0x7fffffff];
- Expect.fail("RangeError is expected");
- } on RangeError {}
+ Expect.throws(() { l[-1] ; }, (e) => e is RangeError);
+ Expect.throws(() { l[l.length] ; }, (e) => e is RangeError);
+ Expect.throws(() { l[0x80000000]; }, (e) => e is RangeError);
+ Expect.throws(() { l[0x7fffffff]; }, (e) => e is RangeError);
}
main() {
check([]);
check([1]);
- var list = new List<int>(255);
+ var list = List<int>.filled(255, 0);
for (int i = 0; i < 255; ++i) {
list[i] = i;
}
diff --git a/LibTest/typed_data/Int64List/operator_subscripted_assignment_A02_t01.dart b/LibTest/typed_data/Int64List/operator_subscripted_assignment_A02_t01.dart
index 3130b3f..b17269f 100644
--- a/LibTest/typed_data/Int64List/operator_subscripted_assignment_A02_t01.dart
+++ b/LibTest/typed_data/Int64List/operator_subscripted_assignment_A02_t01.dart
@@ -16,22 +16,10 @@
check(List<int> list) {
var l = new Int64List.fromList(list);
- try {
- l[-1] = 1;
- Expect.fail("RangeError is expected");
- } on RangeError {}
- try {
- l[l.length] = 1;
- Expect.fail("RangeError is expected");
- } on RangeError {}
- try {
- l[0x80000000] = 1;
- Expect.fail("RangeError is expected");
- } on RangeError {}
- try {
- l[0x7fffffff] = 1;
- Expect.fail("RangeError is expected");
- } on RangeError {}
+ Expect.throws(() { l[-1] = 1; }, (e) => e is RangeError);
+ Expect.throws(() { l[l.length] = 1; }, (e) => e is RangeError);
+ Expect.throws(() { l[0x80000000] = 1; }, (e) => e is RangeError);
+ Expect.throws(() { l[0x7fffffff] = 1; }, (e) => e is RangeError);
}
main() {
diff --git a/LibTest/typed_data/Int64List/reduce_A02_t01.dart b/LibTest/typed_data/Int64List/reduce_A02_t01.dart
index 0179492..425bb9f 100644
--- a/LibTest/typed_data/Int64List/reduce_A02_t01.dart
+++ b/LibTest/typed_data/Int64List/reduce_A02_t01.dart
@@ -16,8 +16,5 @@
main() {
var l = new Int64List.fromList([]);
- try {
- l.reduce((prev, cur) => 0);
- Expect.fail("StateError is expected");
- } on StateError {}
+ Expect.throws(() { l.reduce((prev, cur) => 0); }, (e) => e is StateError);
}
diff --git a/LibTest/typed_data/Int64List/removeAt_A01_t01.dart b/LibTest/typed_data/Int64List/removeAt_A01_t01.dart
index ad7bd68..77e08f8 100644
--- a/LibTest/typed_data/Int64List/removeAt_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/removeAt_A01_t01.dart
@@ -20,10 +20,7 @@
check(List<int> list) {
var l = new Int64List.fromList(list);
var length = l.length;
- try {
- l.removeAt(0);
- Expect.fail("This operation should not be supported");
- } on UnsupportedError {};
+ Expect.throws(() { l.removeAt(0); }, (e) => e is UnsupportedError);
Expect.equals(length, l.length);
}
diff --git a/LibTest/typed_data/Int64List/removeLast_A01_t01.dart b/LibTest/typed_data/Int64List/removeLast_A01_t01.dart
index 86bc961..1c2a1f4 100644
--- a/LibTest/typed_data/Int64List/removeLast_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/removeLast_A01_t01.dart
@@ -18,10 +18,7 @@
check(List<int> list) {
var l = new Int64List.fromList(list);
var length = l.length;
- try {
- l.removeLast();
- Expect.fail("This operation should not be supported");
- } on UnsupportedError {};
+ Expect.throws(() { l.removeLast(); }, (e) => e is UnsupportedError);
Expect.equals(length, l.length);
}
diff --git a/LibTest/typed_data/Int64List/removeRange_A01_t01.dart b/LibTest/typed_data/Int64List/removeRange_A01_t01.dart
index c7bc4d2..e7182c4 100644
--- a/LibTest/typed_data/Int64List/removeRange_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/removeRange_A01_t01.dart
@@ -20,10 +20,7 @@
check(List<int> list) {
var l = new Int64List.fromList(list);
var length = l.length;
- try {
- l.removeRange(0, 1);
- Expect.fail("This operation should not be supported");
- } on UnsupportedError {};
+ Expect.throws(() { l.removeRange(0, 1); }, (e) => e is UnsupportedError);
Expect.equals(length, l.length);
}
diff --git a/LibTest/typed_data/Int64List/removeWhere_A01_t01.dart b/LibTest/typed_data/Int64List/removeWhere_A01_t01.dart
index c899aa8..1b1a751 100644
--- a/LibTest/typed_data/Int64List/removeWhere_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/removeWhere_A01_t01.dart
@@ -19,16 +19,12 @@
check(List<int> list) {
var l = new Int64List.fromList(list);
var length = l.length;
- try {
- l.removeWhere((e) => false);
- Expect.fail("This operation should not be supported");
- } on UnsupportedError {};
+ Expect.throws(
+ () { l.removeWhere((e) => false); }, (e) => e is UnsupportedError);
Expect.equals(length, l.length);
- try {
- l.removeWhere((e) => true);
- Expect.fail("This operation should not be supported");
- } on UnsupportedError {};
+ Expect.throws(
+ () { l.removeWhere((e) => true); }, (e) => e is UnsupportedError);
Expect.equals(length, l.length);
}
diff --git a/LibTest/typed_data/Int64List/remove_A01_t01.dart b/LibTest/typed_data/Int64List/remove_A01_t01.dart
index 7f93a57..b7c6fe4 100644
--- a/LibTest/typed_data/Int64List/remove_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/remove_A01_t01.dart
@@ -20,10 +20,7 @@
check(List<int> list, int element) {
var l = new Int64List.fromList(list);
var length = l.length;
- try {
- l.remove(element);
- Expect.fail("This operation should not be supported");
- } on UnsupportedError {};
+ Expect.throws(() { l.remove(element); }, (e) => e is UnsupportedError);
Expect.equals(length, l.length);
}
diff --git a/LibTest/typed_data/Int64List/replaceRange_A01_t01.dart b/LibTest/typed_data/Int64List/replaceRange_A01_t01.dart
index 836c695..91b9a7a 100644
--- a/LibTest/typed_data/Int64List/replaceRange_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/replaceRange_A01_t01.dart
@@ -22,16 +22,12 @@
check(List<int> list) {
var l = new Int64List.fromList(list);
var length = l.length;
- try {
- l.replaceRange(0, 1, [0]);
- Expect.fail("This operation should not be supported");
- } on UnsupportedError {};
+ Expect.throws(() { l.replaceRange(0, 1, [0]); },
+ (e) => e is UnsupportedError);
Expect.equals(length, l.length);
- try {
- l.replaceRange(0, 100, [0, 1, 2]);
- Expect.fail("This operation should not be supported");
- } on UnsupportedError {};
+ Expect.throws(() { l.replaceRange(0, 100, [0, 1, 2]); },
+ (e) => e is UnsupportedError);
Expect.equals(length, l.length);
}
diff --git a/LibTest/typed_data/Int64List/retainWhere_A01_t01.dart b/LibTest/typed_data/Int64List/retainWhere_A01_t01.dart
index 77965f3..a3af899 100644
--- a/LibTest/typed_data/Int64List/retainWhere_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/retainWhere_A01_t01.dart
@@ -19,16 +19,12 @@
check(List<int> list) {
var l = new Int64List.fromList(list);
var length = l.length;
- try {
- l.retainWhere((e) => true );
- Expect.fail("This operation should not be supported");
- } on UnsupportedError {};
+ Expect.throws(() { l.retainWhere((e) => true ); },
+ (e) => e is UnsupportedError);
Expect.equals(length, l.length);
- try {
- l.retainWhere((e) => false );
- Expect.fail("This operation should not be supported");
- } on UnsupportedError {};
+ Expect.throws(() { l.retainWhere((e) => false ); },
+ (e) => e is UnsupportedError);
Expect.equals(length, l.length);
}
diff --git a/LibTest/typed_data/Int64List/reversed_A01_t01.dart b/LibTest/typed_data/Int64List/reversed_A01_t01.dart
index c32feb2..0d769be 100644
--- a/LibTest/typed_data/Int64List/reversed_A01_t01.dart
+++ b/LibTest/typed_data/Int64List/reversed_A01_t01.dart
@@ -27,7 +27,7 @@
check([1]);
check([1, 2]);
check([1, 2, 3]);
- var list = new List<int>(255);
+ var list = List<int>.filled(255, 0);
for (int i = 0; i < 255; ++i) {
list[i] = i;
}
diff --git a/LibTest/typed_data/Int64List/reversed_A01_t02.dart b/LibTest/typed_data/Int64List/reversed_A01_t02.dart
index f2ff4b9..41dd63d 100644
--- a/LibTest/typed_data/Int64List/reversed_A01_t02.dart
+++ b/LibTest/typed_data/Int64List/reversed_A01_t02.dart
@@ -15,15 +15,12 @@
check(List<int> list) {
dynamic l = new Int64List.fromList(list);
- try {
- l.reversed = list;
- Expect.fail("[reversed] should be read-only");
- } on NoSuchMethodError {}
+ Expect.throws(() { l.reversed = list; }, (e) => e is NoSuchMethodError);
}
main() {
check([]);
- var list = new List<int>(255);
+ var list = List<int>.filled(255, 0);
for (int i = 0; i < 255; ++i) {
list[i] = i;
}
diff --git a/LibTest/typed_data/Int64List/runtimeType_A01_t02.dart b/LibTest/typed_data/Int64List/runtimeType_A01_t02.dart
index a322171..c143b5d 100644
--- a/LibTest/typed_data/Int64List/runtimeType_A01_t02.dart
+++ b/LibTest/typed_data/Int64List/runtimeType_A01_t02.dart
@@ -15,8 +15,5 @@
main() {
dynamic obj = new Int64List(0);
- try {
- obj.runtimeType = null;
- Expect.fail("[runtimeType] should be read-only");
- } on NoSuchMethodError {}
+ Expect.throws(() { obj.runtimeType = null; }, (e) => e is NoSuchMethodError);
}
diff --git a/LibTest/typed_data/Int64List/singleWhere_A02_t01.dart b/LibTest/typed_data/Int64List/singleWhere_A02_t01.dart
index c53824ab..ef90510 100644
--- a/LibTest/typed_data/Int64List/singleWhere_A02_t01.dart
+++ b/LibTest/typed_data/Int64List/singleWhere_A02_t01.dart
@@ -18,20 +18,11 @@
main() {
var l = new Int64List.fromList([]);
- try {
- l.singleWhere((e) => true);
- Expect.fail("StateError is expected");
- } on StateError {}
+ Expect.throws(() { l.singleWhere((e) => true); }, (e) => e is StateError);
l = new Int64List.fromList([1, 2, 3, 4, 5]);
- try {
- l.singleWhere((e) => e == 0);
- Expect.fail("StateError is expected");
- } on StateError {}
+ Expect.throws(() { l.singleWhere((e) => e == 0); }, (e) => e is StateError);
l = new Int64List.fromList([1, 2, 3, 4, 5]);
- try {
- l.singleWhere((e) => false);
- Expect.fail("StateError is expected");
- } on StateError {}
+ Expect.throws(() { l.singleWhere((e) => false); }, (e) => e is StateError);
}
diff --git a/LibTest/typed_data/Int64List/singleWhere_A02_t02.dart b/LibTest/typed_data/Int64List/singleWhere_A02_t02.dart
index 1f6f422..da49159 100644
--- a/LibTest/typed_data/Int64List/singleWhere_A02_t02.dart
+++ b/LibTest/typed_data/Int64List/singleWhere_A02_t02.dart
@@ -18,14 +18,8 @@
main() {
var l = new Int64List.fromList([1, 2, 3, 4, 5]);
- try {
- l.singleWhere((e) => true);
- Expect.fail("StateError is expected");
- } on StateError {}
+ Expect.throws(() { l.singleWhere((e) => true); }, (e) => e is StateError);
l = new Int64List.fromList([1, 2, 3, 4, 5]);
- try {
- l.singleWhere((e) => e != 0);
- Expect.fail("StateError is expected");
- } on StateError {}
+ Expect.throws(() { l.singleWhere((e) => e != 0); }, (e) => e is StateError);
}
diff --git a/LibTest/typed_data/Int64List/single_A01_t02.dart b/LibTest/typed_data/Int64List/single_A01_t02.dart
index d5b37fe..15ccc0e 100644
--- a/LibTest/typed_data/Int64List/single_A01_t02.dart
+++ b/LibTest/typed_data/Int64List/single_A01_t02.dart
@@ -15,8 +15,5 @@
main() {
dynamic l = new Int64List.fromList([0]);
- try {
- l.single = 1;
- Expect.fail("[single] should be read-only");
- } on NoSuchMethodError {}
+ Expect.throws(() { l.single = 1; }, (e) => e is NoSuchMethodError);
}
diff --git a/LibTest/typed_data/Int64List/single_A02_t01.dart b/LibTest/typed_data/Int64List/single_A02_t01.dart
index 0e2f4bc..fd8568c 100644
--- a/LibTest/typed_data/Int64List/single_A02_t01.dart
+++ b/LibTest/typed_data/Int64List/single_A02_t01.dart
@@ -15,8 +15,5 @@
main() {
var l = new Int64List.fromList([]);
- try {
- l.single;
- Expect.fail("StateError is expected");
- } on StateError {}
+ Expect.throws(() { l.single; }, (e) => e is StateError);
}
diff --git a/LibTest/typed_data/Int64List/single_A02_t02.dart b/LibTest/typed_data/Int64List/single_A02_t02.dart
index a20ce54..62e65f8 100644
--- a/LibTest/typed_data/Int64List/single_A02_t02.dart
+++ b/LibTest/typed_data/Int64List/single_A02_t02.dart
@@ -16,10 +16,7 @@
check(List<int> array) {
var l = new Int64List.fromList(array);
- try {
- l.single;
- Expect.fail("StateError is expected");
- } on StateError {}
+ Expect.throws(() { l.single; }, (e) => e is StateError);
}
main() {
diff --git a/LibTest/typed_data/Int64List/toList_A02_t01.dart b/LibTest/typed_data/Int64List/toList_A02_t01.dart
index f01877d..826b481 100644
--- a/LibTest/typed_data/Int64List/toList_A02_t01.dart
+++ b/LibTest/typed_data/Int64List/toList_A02_t01.dart
@@ -18,10 +18,6 @@
main() {
Int64List list = new Int64List.fromList([0]);
dynamic resList = list.toList(growable: false);
-
- try {
- resList.length = 10;
- Expect.fail("List should be fixed-length");
- } on UnsupportedError {}
+ Expect.throws(() { resList.length = 10; }, (e) => e is UnsupportedError);
Expect.equals(1, resList.length);
}
diff --git a/LibTest/typed_data/Int64List/toList_A02_t02.dart b/LibTest/typed_data/Int64List/toList_A02_t02.dart
index 775783c..f3e2c46 100644
--- a/LibTest/typed_data/Int64List/toList_A02_t02.dart
+++ b/LibTest/typed_data/Int64List/toList_A02_t02.dart
@@ -19,15 +19,14 @@
var list = new Int64List.fromList([0]);
var resList = list.toList(growable: true);
- resList.length = 2;
- Expect.equals(2, resList.length);
+ Expect.equals(1, resList.length);
resList.add(1);
- Expect.equals(3, resList.length);
+ Expect.equals(2, resList.length);
resList.addAll([1, 2, 3]);
- Expect.equals(6, resList.length);
+ Expect.equals(5, resList.length);
resList.removeLast();
- Expect.equals(5, resList.length);
+ Expect.equals(4, resList.length);
resList.clear();
Expect.equals(0, resList.length);
}