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

Side by Side Diff: tests/language/implicit_closure_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 invocation of implicit closures. 4 // Dart test program for testing invocation of implicit closures.
5 // VMOptions= 5 // VMOptions=
6 // VMOptions=--use_slow_path 6 // VMOptions=--use_slow_path
7 7
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 9
10 class First { 10 class First {
11 First(this.i) {} 11 First(this.i) {}
12 var b; 12 var b;
13 int foo() { return i; } 13 int foo() {
14 return i;
15 }
16
14 Function foo1() { 17 Function foo1() {
15 local() { 18 local() {
16 return i; 19 return i;
17 } 20 }
21
18 return local; 22 return local;
19 } 23 }
24
20 int i; 25 int i;
21 } 26 }
22 27
23 class ImplicitClosureTest { 28 class ImplicitClosureTest {
24 static void testMain() { 29 static void testMain() {
25 First obj = new First(20); 30 First obj = new First(20);
26 31
27 Function func = () => obj.i; 32 Function func = () => obj.i;
28 obj.b = func; 33 obj.b = func;
29 Expect.equals(20, obj.b()); 34 Expect.equals(20, obj.b());
30 35
31 var ib1 = obj.foo1(); 36 var ib1 = obj.foo1();
32 Expect.equals(obj.i, ib1()); 37 Expect.equals(obj.i, ib1());
33 38
34 var ib = obj.foo; 39 var ib = obj.foo;
35 Expect.equals(obj.i, ib()); 40 Expect.equals(obj.i, ib());
36 } 41 }
37 } 42 }
38 43
39
40 main() { 44 main() {
41 ImplicitClosureTest.testMain(); 45 ImplicitClosureTest.testMain();
42 } 46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698