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

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 regression test 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
« runtime/vm/parser.cc ('K') | « 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 try {
12 test1();
13 print("Unexpected 1"); // should never go here
14 Expect.isTrue(false);
15 } catch (e) {
16 print("main catch 1: $e");
17 Expect.equals(e, "Ball");
18 }
Ivan Posva 2016/01/06 16:35:47 Please add some state verifying that the catch cla
Florian Schneider 2016/01/06 16:40:06 Done.
19 print("== test2 ==");
20 try {
21 test2();
22 print("Unexpected 2"); // should never go here
23 Expect.isTrue(false);
24 } catch (e) {
25 print("main catch 2: $e");
26 Expect.equals(e, "Ball");
27 }
Ivan Posva 2016/01/06 16:35:47 ditto.
Florian Schneider 2016/01/06 16:40:07 Done.
28 }
29
30 void test1() {
31 try {
32 throw "Ball";
33 } finally {
34 try {
35 throw "Frisbee";
36 } catch(e) {
37 print("test 1 catch: $e");
38 Expect.equals(e, "Frisbee");
39 }
40 }
41 }
42
43 void test2() {
44 try {
45 throwError(); // call a method that throws an error
46 } finally {
47 try {
48 throw "Frisbee";
49 } catch(e) {
50 print("test 2 catch: $e");
51 Expect.equals(e, "Frisbee");
52 }
53 }
54 }
55
56
57 void throwError() {
58 throw "Ball";
59 }
OLDNEW
« runtime/vm/parser.cc ('K') | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698