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

Unified 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 side-by-side diff with in-line comments
Download patch
« runtime/vm/parser.cc ('K') | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/try_finally_regress_25333_test.dart
diff --git a/tests/language/try_finally_regress_25333_test.dart b/tests/language/try_finally_regress_25333_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e5db7eed9f9ea56470c2ca696ff2c3bd713762f6
--- /dev/null
+++ b/tests/language/try_finally_regress_25333_test.dart
@@ -0,0 +1,59 @@
+// Copyright (c) 2016, 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.
+
+// Test correct handling of try-catch inside try-finally.
+
+import "package:expect/expect.dart";
+
+void main() {
+ print("== test1 ==");
+ try {
+ test1();
+ print("Unexpected 1"); // should never go here
+ Expect.isTrue(false);
+ } catch (e) {
+ print("main catch 1: $e");
+ Expect.equals(e, "Ball");
+ }
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.
+ print("== test2 ==");
+ try {
+ test2();
+ print("Unexpected 2"); // should never go here
+ Expect.isTrue(false);
+ } catch (e) {
+ print("main catch 2: $e");
+ Expect.equals(e, "Ball");
+ }
Ivan Posva 2016/01/06 16:35:47 ditto.
Florian Schneider 2016/01/06 16:40:07 Done.
+}
+
+void test1() {
+ try {
+ throw "Ball";
+ } finally {
+ try {
+ throw "Frisbee";
+ } catch(e) {
+ print("test 1 catch: $e");
+ Expect.equals(e, "Frisbee");
+ }
+ }
+}
+
+void test2() {
+ try {
+ throwError(); // call a method that throws an error
+ } finally {
+ try {
+ throw "Frisbee";
+ } catch(e) {
+ print("test 2 catch: $e");
+ Expect.equals(e, "Frisbee");
+ }
+ }
+}
+
+
+void throwError() {
+ throw "Ball";
+}
« 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