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

Side by Side Diff: tests/language/rewrite_while_many_exits_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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 var baz_clicks = 0; 7 var baz_clicks = 0;
8 8
9 baz() { 9 baz() {
10 return ++baz_clicks; 10 return ++baz_clicks;
11 } 11 }
12 12
13 var global = 0; 13 var global = 0;
14 14
15 increment_global() { 15 increment_global() {
16 ++global; 16 ++global;
17 return global <= 10; 17 return global <= 10;
18 } 18 }
19 19
20 foo(x, y) { 20 foo(x, y) {
21 var n = 0; 21 var n = 0;
22 while (true) { 22 while (true) {
23 baz(); 23 baz();
24 if (n >= x) { 24 if (n >= x) {
25 return n; 25 return n;
26 }
27 baz();
28 if (n >= y) {
29 return n;
30 }
31 n = n + 1;
32 } 26 }
27 baz();
28 if (n >= y) {
29 return n;
30 }
31 n = n + 1;
32 }
33 } 33 }
34 34
35 bar() { 35 bar() {
36 while (increment_global()) { 36 while (increment_global()) {
37 baz(); 37 baz();
38 } 38 }
39 return baz(); 39 return baz();
40 } 40 }
41 41
42 main() { 42 main() {
43 Expect.equals(10, foo(10, 20)); 43 Expect.equals(10, foo(10, 20));
44 Expect.equals(10, foo(20, 10)); 44 Expect.equals(10, foo(20, 10));
45 45
46 baz_clicks = 0; 46 baz_clicks = 0;
47 Expect.equals(11, bar()); 47 Expect.equals(11, bar());
48 } 48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698