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

Side by Side Diff: tests/language/execute_finally9_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 // This test ensures that the finally block executes correctly when 4 // This test ensures that the finally block executes correctly when
5 // there are throw, break and return statements in the finally block. 5 // there are throw, break and return statements in the finally block.
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 8
9 class Hello { 9 class Hello {
10 static var sum; 10 static var sum;
11 11
12 static foo() { 12 static foo() {
13 sum = 0; 13 sum = 0;
14 try { 14 try {
15 sum += 1; 15 sum += 1;
16 return 'hi'; 16 return 'hi';
17 } catch (e) { 17 } catch (e) {
18 sum += 1; 18 sum += 1;
19 throw 'ball'; 19 throw 'ball';
20 sum += 1; 20 sum += 1;
21 } finally { 21 } finally {
22 sum += 1; 22 sum += 1;
23 throw 'ball'; 23 throw 'ball';
24 sum += 1; 24 sum += 1;
25 } 25 }
26 } 26 }
27 27
28 static foo1() { 28 static foo1() {
29 bool loop = true; 29 bool loop = true;
30 sum = 0; 30 sum = 0;
31 L:while (loop) { 31 L:
32 try { 32 while (loop) {
33 sum += 1; 33 try {
34 return 'hi'; 34 sum += 1;
35 } catch (ex) { 35 return 'hi';
36 sum += 1; 36 } catch (ex) {
37 } finally { 37 sum += 1;
38 try { 38 } finally {
39 L1:while (loop) { 39 try {
40 sum += 1; 40 L1:
41 break L; 41 while (loop) {
42 sum += 1; 42 sum += 1;
43 } 43 break L;
44 } catch (ex) { 44 sum += 1;
45 sum += 1; 45 }
46 } finally { 46 } catch (ex) {
47 sum += 1; 47 sum += 1;
48 } 48 } finally {
49 } 49 sum += 1;
50 } 50 }
51 } 51 }
52 }
53 }
52 54
53 static void main() { 55 static void main() {
54 foo1(); 56 foo1();
55 Expect.equals(3, sum); 57 Expect.equals(3, sum);
56 try { 58 try {
57 foo(); 59 foo();
58 } catch (e) { 60 } catch (e) {
59 // Ignore. 61 // Ignore.
60 } 62 }
61 Expect.equals(2, sum); 63 Expect.equals(2, sum);
62 } 64 }
63
64 } 65 }
65 66
66 main() { 67 main() {
67 Hello.main(); 68 Hello.main();
68 } 69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698