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

Unified Diff: tests/corelib/list_removeat_test.dart

Issue 2879153005: Add support to dart2js for option --enable-asserts. (Closed)
Patch Set: Formatting Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: tests/corelib/list_removeat_test.dart
diff --git a/tests/corelib/list_removeat_test.dart b/tests/corelib/list_removeat_test.dart
index 758e9204dffd2f0721cfd0daa417ad1f89f77636..ca058835de5f3b24f468ff6004ea65113a5d3b67 100644
--- a/tests/corelib/list_removeat_test.dart
+++ b/tests/corelib/list_removeat_test.dart
@@ -20,11 +20,18 @@ class MyList extends ListBase {
String toString() => "[" + join(", ") + "]";
}
+final bool isCheckedMode = (() {
+ try {
+ var i = 42;
+ String s = i;
+ } on TypeError catch (e) {
+ return true;
+ }
+ return false;
+})();
sra1 2017/05/24 01:30:46 delete
eernst 2017/07/07 08:50:29 Done.
+
// l1 must be a modifiable list with 5 elements from 0 to 4.
void testModifiableList(l1) {
- bool checkedMode = false;
- assert(checkedMode = true);
-
// Index must be integer and in range.
Expect.throws(() {
l1.removeAt(-1);
@@ -37,10 +44,12 @@ void testModifiableList(l1) {
}, (e) => e is ArgumentError, "too large");
Expect.throws(() {
l1.removeAt("1");
- }, (e) => (checkedMode ? e is TypeError : e is ArgumentError), "string");
+ }, (e) => (typeAssertionsEnabled ? e is TypeError : e is ArgumentError),
+ "string");
Expect.throws(() {
l1.removeAt(1.5);
- }, (e) => (checkedMode ? e is TypeError : e is ArgumentError), "double");
+ }, (e) => (typeAssertionsEnabled ? e is TypeError : e is ArgumentError),
+ "double");
Expect.equals(2, l1.removeAt(2), "l1-remove2");
Expect.equals(1, l1[1], "l1-1[1]");

Powered by Google App Engine
This is Rietveld 408576698