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

Side by Side Diff: tests/language/execute_finally6_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 // Dart test program for testing execution of finally blocks on 4 // Dart test program for testing execution of finally blocks on
5 // control flow breaks because of 'return', 'continue' etc. 5 // control flow breaks because of 'return', 'continue' etc.
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 8
9
10 class Helper { 9 class Helper {
11 Helper() : i = 0 { } 10 Helper() : i = 0 {}
12 11
13 int f1() { 12 int f1() {
14 try { 13 try {
15 try { 14 try {
16 int j; 15 int j;
17 j = func(); 16 j = func();
18 L1: 17 L1:
19 while (i <= 0) { 18 while (i <= 0) {
20 if (i == 0) { 19 if (i == 0) {
21 try { 20 try {
22 i = 1; 21 i = 1;
23 func(); 22 func();
24 try { 23 try {
25 int j; 24 int j;
26 j = func(); 25 j = func();
27 L1: 26 L1:
28 while (j < 50) { 27 while (j < 50) {
29 j += func(); 28 j += func();
30 if (j > 30) { 29 if (j > 30) {
31 break L1; // Break out of nested try blocks. 30 break L1; // Break out of nested try blocks.
32 } 31 }
33 } 32 }
34 i += 200000; // Should get executed. 33 i += 200000; // Should get executed.
35 } finally { 34 } finally {
36 i = i + 200; // Should get executed as normal control flow. 35 i = i + 200; // Should get executed as normal control flow.
37 } 36 }
38 } finally { 37 } finally {
39 i = i + 400; // Should get executed as normal control flow. 38 i = i + 400; // Should get executed as normal control flow.
40 } 39 }
41 } 40 }
42 } 41 }
43 } finally { 42 } finally {
44 i = i + 800; // Should get executed as normal control flow. 43 i = i + 800; // Should get executed as normal control flow.
45 } 44 }
46 return i; // Value of i should be 201401. 45 return i; // Value of i should be 201401.
47 } finally { 46 } finally {
48 i = i + 1600; // Should get executed as part of return above. 47 i = i + 1600; // Should get executed as part of return above.
49 } 48 }
50 i = i + 2000000; // Should not get executed. 49 i = i + 2000000; // Should not get executed.
51 return 1; 50 return 1;
52 } 51 }
53 52
54 static int func() { 53 static int func() {
55 int i = 0; 54 int i = 0;
56 while (i < 10) { 55 while (i < 10) {
57 i++; 56 i++;
58 } 57 }
59 return i; 58 return i;
60 } 59 }
61 60
62 int i; 61 int i;
63 } 62 }
64 63
65 class ExecuteFinally6Test { 64 class ExecuteFinally6Test {
66 static testMain() { 65 static testMain() {
67 Helper obj = new Helper(); 66 Helper obj = new Helper();
68 Expect.equals(201401, obj.f1()); 67 Expect.equals(201401, obj.f1());
69 Expect.equals(203001, obj.i); 68 Expect.equals(203001, obj.i);
70 } 69 }
71 } 70 }
72 71
73 main() { 72 main() {
74 ExecuteFinally6Test.testMain(); 73 ExecuteFinally6Test.testMain();
75 } 74 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698