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

Unified Diff: pkg/kernel/testcases/interpreter/try_catch_finally_test.dart

Issue 3002003002: Add support for catch statements. (Closed)
Patch Set: Remove formatting changes Created 3 years, 4 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
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;
+}
« no previous file with comments | « pkg/kernel/lib/interpreter/interpreter.dart ('k') | pkg/kernel/testcases/interpreter/try_catch_finally_test.dart.expect » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698