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

Side by Side 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: Updated cf. comments. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/language/library_ambiguous_test.dart ('k') | tests/language/malformed2_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 part of malformed_test;
6
7 /// [o] is either `null` or `new List<String>()`.
8 void testValue(var o) {
9 assert(o == null || o is List<String>);
10
11 test(true, () => o is Unresolved, "$o is Unresolved");
12 test(false, () => o is List<Unresolved>, "$o is List<Unresolved>");
13 test(true, () => o is! Unresolved, "$o is! Unresolved");
14 test(false, () => o is! List<Unresolved>, "$o is List<Unresolved>");
15
16 test(true, () => o as Unresolved, "$o as Unresolved");
17 test(false, () => o as List<Unresolved>, "$o as List<Unresolved>");
18
19 test(false, () {
20 try {
21 } on Unresolved catch (e) {
22 } catch (e) {
23 }
24 }, "on Unresolved catch: Nothing thrown.");
25 test(true, () {
26 try {
27 throw o;
28 } on Unresolved catch (e) {
29 } catch (e) {
30 }
31 }, "on Unresolved catch ($o)");
32 test(false, () {
33 try {
34 throw o;
35 } on List<String> catch (e) {
36 } on NullThrownError catch (e) {
37 } on Unresolved catch (e) {
38 } catch (e) {
39 }
40 }, "on List<String>/NullThrowError catch ($o)");
41 test(false, () {
42 try {
43 throw o;
44 } on List<Unresolved> catch (e) {
45 } on NullThrownError catch (e) {
46 } on Unresolved catch (e) {
47 } catch (e) {
48 }
49 }, "on List<Unresolved>/NullThrowError catch ($o)");
50
51 test(o != null && inCheckedMode(),
52 () { Unresolved u = o; },
53 "Unresolved u = $o;");
54 test(false,
55 () { List<Unresolved> u = o; },
56 "List<Unresolved> u = $o;");
57 }
OLDNEW
« no previous file with comments | « tests/language/library_ambiguous_test.dart ('k') | tests/language/malformed2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698