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

Side by Side Diff: tests/language/branches_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 for branches. Make sure that shortcuts work, even if they have 4 // Dart test for branches. Make sure that shortcuts work, even if they have
5 // to jump over several expressions. 5 // to jump over several expressions.
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 8
9 class BranchesTest { 9 class BranchesTest {
10 static bool f() { 10 static bool f() {
11 Expect.equals("Never reached", 0); 11 Expect.equals("Never reached", 0);
12 return true; 12 return true;
13 } 13 }
14 14
15 static void testMain() { 15 static void testMain() {
16 int checkPointCounter = 1; 16 int checkPointCounter = 1;
17 int checkPoint1 = 0; 17 int checkPoint1 = 0;
18 int checkPoint2 = 0; 18 int checkPoint2 = 0;
19 int checkPoint3 = 0; 19 int checkPoint3 = 0;
20 int checkPoint4 = 0; 20 int checkPoint4 = 0;
21 int checkPoint5 = 0; 21 int checkPoint5 = 0;
22 int checkPoint6 = 0; 22 int checkPoint6 = 0;
23 int i = 0; 23 int i = 0;
24 for (int i = 0; i < 2; i++) { 24 for (int i = 0; i < 2; i++) {
25 if (i == 0) { 25 if (i == 0) {
26 checkPoint1 += checkPointCounter++; 26 checkPoint1 += checkPointCounter++;
27 if (true || // Test branch-if-true. 27 if (true || // Test branch-if-true.
28 f() || 28 f() ||
29 f() || 29 f() ||
30 f() || 30 f() ||
31 f() || 31 f() ||
32 f() || 32 f() ||
33 f() || 33 f() ||
34 f() || 34 f() ||
35 f() || 35 f() ||
36 f() || 36 f() ||
37 f() || 37 f() ||
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 f() || 74 f() ||
75 f() || 75 f() ||
76 f() || 76 f() ||
77 f() || 77 f() ||
78 f() || 78 f() ||
79 f() || 79 f() ||
80 f() || 80 f() ||
81 f()) { 81 f()) {
82 checkPoint2 += checkPointCounter++; 82 checkPoint2 += checkPointCounter++;
83 } 83 }
84 } else { // Test branch (jumping over the else branch). 84 } else {
85 // Test branch (jumping over the else branch).
85 checkPoint3 += checkPointCounter++; 86 checkPoint3 += checkPointCounter++;
86 if (false) { 87 if (false) {
87 checkPoint4 = checkPointCounter++; // Never reached. 88 checkPoint4 = checkPointCounter++; // Never reached.
88 checkPoint4 = checkPointCounter++; // Never reached. 89 checkPoint4 = checkPointCounter++; // Never reached.
89 checkPoint4 = checkPointCounter++; // Never reached. 90 checkPoint4 = checkPointCounter++; // Never reached.
90 checkPoint4 = checkPointCounter++; // Never reached. 91 checkPoint4 = checkPointCounter++; // Never reached.
91 checkPoint4 = checkPointCounter++; // Never reached. 92 checkPoint4 = checkPointCounter++; // Never reached.
92 checkPoint4 = checkPointCounter++; // Never reached. 93 checkPoint4 = checkPointCounter++; // Never reached.
93 checkPoint4 = checkPointCounter++; // Never reached. 94 checkPoint4 = checkPointCounter++; // Never reached.
94 checkPoint4 = checkPointCounter++; // Never reached. 95 checkPoint4 = checkPointCounter++; // Never reached.
95 checkPoint4 = checkPointCounter++; // Never reached. 96 checkPoint4 = checkPointCounter++; // Never reached.
96 checkPoint4 = checkPointCounter++; // Never reached. 97 checkPoint4 = checkPointCounter++; // Never reached.
97 checkPoint4 = checkPointCounter++; // Never reached. 98 checkPoint4 = checkPointCounter++; // Never reached.
98 checkPoint4 = checkPointCounter++; // Never reached. 99 checkPoint4 = checkPointCounter++; // Never reached.
99 checkPoint4 = checkPointCounter++; // Never reached. 100 checkPoint4 = checkPointCounter++; // Never reached.
100 checkPoint4 = checkPointCounter++; // Never reached. 101 checkPoint4 = checkPointCounter++; // Never reached.
101 checkPoint4 = checkPointCounter++; // Never reached. 102 checkPoint4 = checkPointCounter++; // Never reached.
102 checkPoint4 = checkPointCounter++; // Never reached. 103 checkPoint4 = checkPointCounter++; // Never reached.
103 checkPoint4 = checkPointCounter++; // Never reached. 104 checkPoint4 = checkPointCounter++; // Never reached.
104 checkPoint4 = checkPointCounter++; // Never reached. 105 checkPoint4 = checkPointCounter++; // Never reached.
105 checkPoint4 = checkPointCounter++; // Never reached. 106 checkPoint4 = checkPointCounter++; // Never reached.
106 checkPoint4 = checkPointCounter++; // Never reached. 107 checkPoint4 = checkPointCounter++; // Never reached.
107 checkPoint4 = checkPointCounter++; // Never reached. 108 checkPoint4 = checkPointCounter++; // Never reached.
108 checkPoint4 = checkPointCounter++; // Never reached. 109 checkPoint4 = checkPointCounter++; // Never reached.
109 checkPoint4 = checkPointCounter++; // Never reached. 110 checkPoint4 = checkPointCounter++; // Never reached.
110 checkPoint4 = checkPointCounter++; // Never reached. 111 checkPoint4 = checkPointCounter++; // Never reached.
111 checkPoint4 = checkPointCounter++; // Never reached. 112 checkPoint4 = checkPointCounter++; // Never reached.
112 checkPoint4 = checkPointCounter++; // Never reached. 113 checkPoint4 = checkPointCounter++; // Never reached.
113 checkPoint4 = checkPointCounter++; // Never reached. 114 checkPoint4 = checkPointCounter++; // Never reached.
114 checkPoint4 = checkPointCounter++; // Never reached. 115 checkPoint4 = checkPointCounter++; // Never reached.
115 checkPoint4 = checkPointCounter++; // Never reached. 116 checkPoint4 = checkPointCounter++; // Never reached.
116 checkPoint4 = checkPointCounter++; // Never reached. 117 checkPoint4 = checkPointCounter++; // Never reached.
117 checkPoint4 = checkPointCounter++; // Never reached. 118 checkPoint4 = checkPointCounter++; // Never reached.
118 checkPoint4 = checkPointCounter++; // Never reached. 119 checkPoint4 = checkPointCounter++; // Never reached.
119 checkPoint4 = checkPointCounter++; // Never reached. 120 checkPoint4 = checkPointCounter++; // Never reached.
120 checkPoint4 = checkPointCounter++; // Never reached. 121 checkPoint4 = checkPointCounter++; // Never reached.
121 checkPoint4 = checkPointCounter++; // Never reached. 122 checkPoint4 = checkPointCounter++; // Never reached.
122 checkPoint4 = checkPointCounter++; // Never reached. 123 checkPoint4 = checkPointCounter++; // Never reached.
123 checkPoint4 = checkPointCounter++; // Never reached. 124 checkPoint4 = checkPointCounter++; // Never reached.
124 checkPoint4 = checkPointCounter++; // Never reached. 125 checkPoint4 = checkPointCounter++; // Never reached.
125 checkPoint4 = checkPointCounter++; // Never reached. 126 checkPoint4 = checkPointCounter++; // Never reached.
126 checkPoint4 = checkPointCounter++; // Never reached. 127 checkPoint4 = checkPointCounter++; // Never reached.
127 checkPoint4 = checkPointCounter++; // Never reached. 128 checkPoint4 = checkPointCounter++; // Never reached.
128 checkPoint4 = checkPointCounter++; // Never reached. 129 checkPoint4 = checkPointCounter++; // Never reached.
129 checkPoint4 = checkPointCounter++; // Never reached. 130 checkPoint4 = checkPointCounter++; // Never reached.
130 checkPoint4 = checkPointCounter++; // Never reached. 131 checkPoint4 = checkPointCounter++; // Never reached.
131 checkPoint4 = checkPointCounter++; // Never reached. 132 checkPoint4 = checkPointCounter++; // Never reached.
132 checkPoint4 = checkPointCounter++; // Never reached. 133 checkPoint4 = checkPointCounter++; // Never reached.
133 checkPoint4 = checkPointCounter++; // Never reached. 134 checkPoint4 = checkPointCounter++; // Never reached.
134 checkPoint4 = checkPointCounter++; // Never reached. 135 checkPoint4 = checkPointCounter++; // Never reached.
135 checkPoint4 = checkPointCounter++; // Never reached. 136 checkPoint4 = checkPointCounter++; // Never reached.
136 checkPoint4 = checkPointCounter++; // Never reached. 137 checkPoint4 = checkPointCounter++; // Never reached.
137 checkPoint4 = checkPointCounter++; // Never reached. 138 checkPoint4 = checkPointCounter++; // Never reached.
138 checkPoint4 = checkPointCounter++; // Never reached. 139 checkPoint4 = checkPointCounter++; // Never reached.
139 checkPoint4 = checkPointCounter++; // Never reached. 140 checkPoint4 = checkPointCounter++; // Never reached.
140 checkPoint4 = checkPointCounter++; // Never reached. 141 checkPoint4 = checkPointCounter++; // Never reached.
141 checkPoint4 = checkPointCounter++; // Never reached. 142 checkPoint4 = checkPointCounter++; // Never reached.
142 } 143 }
143 } 144 }
144 checkPoint5 += checkPointCounter++; 145 checkPoint5 += checkPointCounter++;
145 } 146 }
146 checkPoint6 += checkPointCounter++; 147 checkPoint6 += checkPointCounter++;
147 Expect.equals(1, checkPoint1); 148 Expect.equals(1, checkPoint1);
148 Expect.equals(2, checkPoint2); 149 Expect.equals(2, checkPoint2);
149 Expect.equals(4, checkPoint3); 150 Expect.equals(4, checkPoint3);
150 Expect.equals(0, checkPoint4); 151 Expect.equals(0, checkPoint4);
151 Expect.equals(8, checkPoint5); 152 Expect.equals(8, checkPoint5);
152 Expect.equals(6, checkPoint6); 153 Expect.equals(6, checkPoint6);
153 } 154 }
154 } 155 }
155 156
156 main() { 157 main() {
157 BranchesTest.testMain(); 158 BranchesTest.testMain();
158 } 159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698