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

Side by Side Diff: tests/language/src/ExecuteFinally6Test.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 L1:
26 while (j < 50) {
27 j += func();
28 if (j > 30) {
29 break L1; // Break out of nested try blocks.
30 }
31 }
32 i += 200000; // Should get executed.
33 } finally {
34 i = i + 200; // Should get executed as normal control flow.
35 }
36 } finally {
37 i = i + 400; // Should get executed as normal control flow.
38 }
39 }
40 }
41 } finally {
42 i = i + 800; // Should get executed as normal control flow.
43 }
44 return i; // Value of i should be 201401.
45 } finally {
46 i = i + 1600; // Should get executed as part of return above.
47 }
48 i = i + 2000000; // Should not get executed.
49 return 1;
50 }
51
52 static int func() {
53 int i = 0;
54 while (i < 10) {
55 i++;
56 }
57 return i;
58 }
59
60 int i;
61 }
62
63 class ExecuteFinally6Test {
64 static testMain() {
65 Helper obj = new Helper();
66 Expect.equals(201401, obj.f1());
67 Expect.equals(203001, obj.i);
68 }
69 }
70
71 main() {
72 ExecuteFinally6Test.testMain();
73 }
OLDNEW
« no previous file with comments | « tests/language/src/ExecuteFinally5Test.dart ('k') | tests/language/src/ExecuteFinally7Test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698