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

Unified Diff: tests/language/type_error_test.dart

Issue 2879153005: Add support to dart2js for option --enable-asserts. (Closed)
Patch Set: Adjusted the status of two tests and the logic of one test, to make them work with --enable-asserts 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/language/type_error_test.dart
diff --git a/tests/language/type_error_test.dart b/tests/language/type_error_test.dart
index fc62c23b936709710aef4246c03d3eb91bf3e087..ab1cfab87103826e3e89ebb99ada5c802acc7776 100644
--- a/tests/language/type_error_test.dart
+++ b/tests/language/type_error_test.dart
@@ -132,10 +132,10 @@ checkTypeError(o) {
print(o);
} on TypeError catch (e) {
print(e); // This might provoke an error.
- if (assertionsEnabled) return; // Expected type error.
+ if (isCheckedMode) return; // Expected type error.
rethrow; // Rethrow unexpected type error.
}
- if (assertionsEnabled) {
+ if (isCheckedMode) {
throw 'expected TypeError';
}
}
@@ -162,6 +162,16 @@ checkCastError(o) {
throw 'expected CastError';
}
+final bool isCheckedMode = (() {
+ try {
+ var i = 42;
+ String s = i;
+ } on TypeError catch (e) {
+ return true;
+ }
+ return false;
+})();
+
bool assertionsEnabled = false;
main() {

Powered by Google App Engine
This is Rietveld 408576698