Index: pkg/kernel/testcases/interpreter/try_catch_finally_test.dart |
diff --git a/pkg/kernel/testcases/interpreter/try_catch_finally_test.dart b/pkg/kernel/testcases/interpreter/try_catch_finally_test.dart |
index fc4649d4aa488fd54d5de226a6d5a67d2af5e3d0..5ad2a3f8899fb5b3340011ff05b1d0afddb75854 100644 |
--- a/pkg/kernel/testcases/interpreter/try_catch_finally_test.dart |
+++ b/pkg/kernel/testcases/interpreter/try_catch_finally_test.dart |
@@ -9,11 +9,13 @@ main() { |
print('hello2'); |
} |
print('hello3'); |
- print(foo()); |
- print(bar()); |
+ print(fReturns()); |
+ print(fFinalizes()); |
+ print(fThrows()); |
} |
-int foo() { |
+/// Tests that the return in finally is executed. |
+int fReturns() { |
try { |
print('foo 1'); |
return 1; |
@@ -23,7 +25,8 @@ int foo() { |
} |
} |
-int bar() { |
+/// Tests that finally is executed before returning. |
+int fFinalizes() { |
try { |
print('bar 1'); |
return 1; |
@@ -32,3 +35,16 @@ int bar() { |
} |
return 0; |
} |
+ |
+/// Tests that the exception is caught. |
+int fThrows() { |
+ try { |
+ print(37); |
+ throw 'Error'; |
+ } catch (e, _) { |
+ print('Caught $e'); |
+ } finally { |
+ print("Finalizer"); |
+ } |
+ return 34; |
+} |