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

Unified Diff: tests/kernel/unsorted/rethrow_test.dart

Issue 2434123003: Merge more Kernel infrastructure from kernel_sdk SDK fork. (Closed)
Patch Set: Created 4 years, 2 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: tests/kernel/unsorted/rethrow_test.dart
diff --git a/tests/kernel/unsorted/rethrow_test.dart b/tests/kernel/unsorted/rethrow_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..065d36fc328ad83ee741add1f585f45e222dddfd
--- /dev/null
+++ b/tests/kernel/unsorted/rethrow_test.dart
@@ -0,0 +1,63 @@
+import 'expect.dart';
Kevin Millikin (Google) 2016/10/21 09:10:58 Copyright header.
Vyacheslav Egorov (Google) 2016/10/21 13:39:43 Done.
+
+testNormalRethrow() {
+ var x = 0;
+ try {
+ try {
+ throw x++;
+ } catch (e) {
+ Expect.isTrue(e == 0);
+ x++;
+ rethrow;
+ }
+ } catch (e) {
+ Expect.isTrue(e == 0);
+ x++;
+ }
+ Expect.isTrue(x == 3);
+}
+
+testNormalRethrow2() {
+ var x = 0;
+ try {
+ try {
+ throw x++;
+ } on int catch (e) {
+ Expect.isTrue(e == 0);
+ x++;
+ rethrow;
+ }
+ } catch (e) {
+ Expect.isTrue(e == 0);
+ x++;
+ }
+ Expect.isTrue(x == 3);
+}
+
+testRethrowWithinTryRethrow() {
+ var x = 0;
+ try {
+ try {
+ throw x++;
+ } on int catch (e) {
+ Expect.isTrue(e == 0);
+ x++;
+ try {
+ x++;
+ rethrow;
+ } finally {
+ x++;
+ }
+ }
+ } catch (e) {
+ Expect.isTrue(e == 0);
+ x++;
+ }
+ Expect.isTrue(x == 5);
+}
+
+main() {
+ testNormalRethrow();
+ testNormalRethrow2();
+ testRethrowWithinTryRethrow();
+}

Powered by Google App Engine
This is Rietveld 408576698