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

Unified Diff: tests/language/malformed2_lib.dart

Issue 54983007: Make test of malformed types a dynamic type error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor fixes. Created 7 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/malformed2_lib.dart
diff --git a/tests/language/malformed2_lib.dart b/tests/language/malformed2_lib.dart
new file mode 100644
index 0000000000000000000000000000000000000000..88ce5ab2f5dbc242284109a1d4da921034410d56
--- /dev/null
+++ b/tests/language/malformed2_lib.dart
@@ -0,0 +1,54 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+part of malformed_test;
+
+void testValue(var o) {
+ test(true, () => o is Unresolved, "$o is Unresolved");
+ test(false, () => o is List<Unresolved>, "$o is List<Unresolved>");
+ test(true, () => o is! Unresolved, "$o is! Unresolved");
+ test(false, () => o is! List<Unresolved>, "$o is List<Unresolved>");
+
+ test(true, () => o as Unresolved, "$o as Unresolved");
+ test(false, () => o as List<Unresolved>, "$o as List<Unresolved>");
+
+ test(false, () {
+ try {
+ } on Unresolved catch (e) {
+ } catch (e) {
+ }
+ }, "on Unresolved catch: Nothing thrown.");
+ test(true, () {
+ try {
+ throw o;
+ } on Unresolved catch (e) {
+ } catch (e) {
+ }
+ }, "on Unresolved catch ($o)");
+ test(false, () {
+ try {
+ throw o;
+ } on List<String> catch (e) {
+ } on NullThrownError catch (e) {
+ } on Unresolved catch (e) {
+ } catch (e) {
+ }
+ }, "on List<String>/NullThrowError catch ($o)");
+ test(false, () {
+ try {
+ throw o;
+ } on List<Unresolved> catch (e) {
karlklose 2013/11/05 09:48:14 Perhaps document in a comment on this method or ma
Johnni Winther 2013/11/05 10:58:41 Done.
+ } on NullThrownError catch (e) {
+ } on Unresolved catch (e) {
+ } catch (e) {
+ }
+ }, "on List<Unresolved>/NullThrowError catch ($o)");
+
+ test(o != null && inCheckedMode(),
+ () { Unresolved u = o; },
+ "Unresolved u = $o;");
+ test(false,
+ () { List<Unresolved> u = o; },
+ "List<Unresolved> u = $o;");
+}

Powered by Google App Engine
This is Rietveld 408576698