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

Side by Side Diff: tests/language/execute_finally1_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 int j; 14 int j;
16 j = func(); 15 j = func();
17 i = 1; 16 i = 1;
18 return i; // Value of i on return is 1. 17 return i; // Value of i on return is 1.
19 } finally { 18 } finally {
20 i = i + 800; // Should get executed on return. 19 i = i + 800; // Should get executed on return.
21 } 20 }
22 return i + 200; // Should not get executed. 21 return i + 200; // Should not get executed.
23 } 22 }
24 23
25 static int func() { 24 static int func() {
26 int i = 0; 25 int i = 0;
27 while (i < 10) { 26 while (i < 10) {
28 i++; 27 i++;
29 } 28 }
30 return i; 29 return i;
31 } 30 }
32 31
33 int i; 32 int i;
34 } 33 }
35 34
36 class ExecuteFinally1Test { 35 class ExecuteFinally1Test {
37 static testMain() { 36 static testMain() {
38 Helper obj = new Helper(); 37 Helper obj = new Helper();
39 Expect.equals(1, obj.f1()); 38 Expect.equals(1, obj.f1());
40 Expect.equals(801, obj.i); 39 Expect.equals(801, obj.i);
41 } 40 }
42 } 41 }
43 42
44 main() { 43 main() {
45 ExecuteFinally1Test.testMain(); 44 ExecuteFinally1Test.testMain();
46 } 45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698