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

Side by Side Diff: dart/tests/language/on_catch_malformed_type_test.dart

Issue 60293003: Version 0.8.10.5 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: 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 | « dart/tests/language/malformed2_test.dart ('k') | dart/tests/language/type_parameter_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
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Check that malformed types in on-catch are handled correctly, that is, 5 // Check that malformed types in on-catch are handled correctly, that is,
6 // are treated as dynamic and thus catches all in bith production and checked 6 // throws a type error in both production and checked mode.
7 // mode. 7
8 import 'package:expect/expect.dart';
8 9
9 catchUnresolvedBefore() { 10 catchUnresolvedBefore() {
10 try { 11 try {
11 throw "foo"; 12 throw "foo";
12 Expect.fail("This code shouldn't be executed"); 13 Expect.fail("This code shouldn't be executed");
13 } on String catch(oks) { 14 } on String catch(oks) {
14 // This is tested before the catch block below. 15 // This is tested before the catch block below.
15 } on Unavailable catch(ex) { 16 } on Unavailable catch(ex) {
16 Expect.fail("This code shouldn't be executed"); 17 Expect.fail("This code shouldn't be executed");
17 } 18 }
18 } 19 }
19 20
20 catchUnresolvedAfter() { 21 catchUnresolvedAfter() {
21 try { 22 Expect.throws(() {
22 throw "foo"; 23 try {
23 Expect.fail("This code shouldn't be executed"); 24 throw "foo";
24 } on Unavailable catch(ex) { 25 Expect.fail("This code shouldn't be executed");
25 // This is tested before the catch block below. 26 } on Unavailable catch(ex) {
26 // In both production and checked mode the test is always true. 27 // This is tested before the catch block below.
27 } on String catch(oks) { 28 // In both production and checked mode the test causes a type error.
28 Expect.fail("This code shouldn't be executed"); 29 } on String catch(oks) {
29 } 30 Expect.fail("This code shouldn't be executed");
31 }
32 }, (e) => e is TypeError);
30 } 33 }
31 34
32 main() { 35 main() {
33 catchUnresolvedBefore(); 36 catchUnresolvedBefore();
34 catchUnresolvedAfter(); 37 catchUnresolvedAfter();
35 } 38 }
OLDNEW
« no previous file with comments | « dart/tests/language/malformed2_test.dart ('k') | dart/tests/language/type_parameter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698