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

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

Issue 1569523002: Fix VM bug with try-catch inside of try-finally. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: added comment Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/parser.cc ('k') | no next file » | 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) 2016, 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 // Test correct handling of try-catch inside try-finally.
6
7 import "package:expect/expect.dart";
8
9 void main() {
10 print("== test1 ==");
11 bool caught = false;
12 try {
13 test1();
14 print("Unexpected 1"); // should never go here
15 Expect.isTrue(false);
16 } catch (e) {
17 caught = true;
18 print("main catch 1: $e");
19 Expect.equals(e, "Ball");
20 }
21 Expect.isTrue(caught);
22 print("== test2 ==");
23 caught = false;
24 try {
25 test2();
26 print("Unexpected 2"); // should never go here
27 Expect.isTrue(false);
28 } catch (e) {
29 caught = true;
30 print("main catch 2: $e");
31 Expect.equals(e, "Ball");
32 }
33 Expect.isTrue(caught);
34 }
35
36 void test1() {
37 try {
38 throw "Ball";
39 } finally {
40 try {
41 throw "Frisbee";
42 } catch(e) {
43 print("test 1 catch: $e");
44 Expect.equals(e, "Frisbee");
45 }
46 }
47 }
48
49 void test2() {
50 try {
51 throwError(); // call a method that throws an error
52 } finally {
53 try {
54 throw "Frisbee";
55 } catch(e) {
56 print("test 2 catch: $e");
57 Expect.equals(e, "Frisbee");
58 }
59 }
60 }
61
62
63 void throwError() {
64 throw "Ball";
65 }
OLDNEW
« no previous file with comments | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698