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

Side by Side Diff: tests/language/src/ExecuteFinally3Test.dart

Issue 10248007: test rename overhaul: step 8 - language tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011, 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 // Dart test program for testing execution of finally blocks on
5 // control flow breaks because of 'return', 'continue' etc.
6
7
8 class Helper {
9 Helper() : i = 0 { }
10
11 int f1() {
12 try {
13 try {
14 int j;
15 j = func();
16 L1:
17 while (i <= 0) {
18 if (i == 0) {
19 try {
20 i = 1;
21 func();
22 try {
23 int j;
24 j = func();
25 while (j < 50) {
26 j += func();
27 if (j > 30) {
28 continue L1; // Break out of nested try blocks.
29 }
30 }
31 i = 200000; // Should not get executed.
32 } finally {
33 i = i + 200; // Should get executed when we break out.
34 }
35 } finally {
36 i = i + 400; // Should get executed when we break out.
37 }
38 }
39 }
40 } finally {
41 i = i + 800; // Should get executed as normal control flow.
42 }
43 return i; // Value of i should be 1401.
44 } finally {
45 i = i + 1600; // Should get executed as part of return above.
46 }
47 i = i + 2000000; // Should not get executed.
48 return 1;
49 }
50
51 static int func() {
52 int i = 0;
53 while (i < 10) {
54 i++;
55 }
56 return i;
57 }
58
59 int i;
60 }
61
62 class ExecuteFinally3Test {
63 static testMain() {
64 Helper obj = new Helper();
65 Expect.equals(1401, obj.f1());
66 Expect.equals(3001, obj.i);
67 }
68 }
69
70 main() {
71 ExecuteFinally3Test.testMain();
72 }
OLDNEW
« no previous file with comments | « tests/language/src/ExecuteFinally2Test.dart ('k') | tests/language/src/ExecuteFinally4Test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698