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

Unified Diff: tests/language/wrong_number_type_arguments_test.dart

Issue 11412245: MalformedType used for all invalid type annotations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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/wrong_number_type_arguments_test.dart
diff --git a/tests/language/wrong_number_type_arguments_test.dart b/tests/language/wrong_number_type_arguments_test.dart
index efb209962d78467cb4711b76fd6f9aa6aa10ff23..9a60ee244459b6344fe9e61cc73efc480dd01efc 100644
--- a/tests/language/wrong_number_type_arguments_test.dart
+++ b/tests/language/wrong_number_type_arguments_test.dart
@@ -4,8 +4,32 @@
// Map takes 2 type arguments.
Map<String> foo; /// 00: static type warning
+Map<String> baz; /// 02: static type warning
main() {
foo = null; /// 00: continued
var bar = new Map<String>(); /// 01: compile-time error
+ testNonNullAssignment(); /// 02: continued
+}
+
+isCheckedMode() {
+ try {
+ var i = 1;
+ String s = i;
+ return false;
+ } catch (e) {
+ return true;
+ }
+}
+
+void testNonNullAssignment() {
+ bool got_type_error = false;
+ try {
+ baz = new Map();
+ } on TypeError catch (error) {
+ print(error);
ngeoffray 2012/11/30 12:00:40 Remove print?
Johnni Winther 2012/12/04 10:07:17 Again, nice to have when the test fails.
+ got_type_error = true;
+ }
+ // Type error in checked mode only.
+ Expect.isTrue(got_type_error == isCheckedMode());
}

Powered by Google App Engine
This is Rietveld 408576698