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

Side by Side Diff: tests/language/generic_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) 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 // Dart test program for constructors and initializers. 4 // Dart test program for constructors and initializers.
5 5
6 // Check that generic closures are properly instantiated. 6 // Check that generic closures are properly instantiated.
7 7
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 9
10 typedef T F<T>(T x); 10 typedef T F<T>(T x);
11 typedef R G<T, R>(T x); 11 typedef R G<T, R>(T x);
12 12
13 class C<T> { 13 class C<T> {
14 get f => (T x) => 2*x; 14 get f => (T x) => 2 * x;
15 T g(T x) => 3*x; 15 T g(T x) => 3 * x;
16 } 16 }
17 17
18 main() { 18 main() {
19 var c = new C<int>(); 19 var c = new C<int>();
20 var f = c.f; 20 var f = c.f;
21 var g = c.g; 21 var g = c.g;
22 Expect.equals(42, f(21)); 22 Expect.equals(42, f(21));
23 Expect.equals(42, g(14)); 23 Expect.equals(42, g(14));
24 Expect.isTrue(f is Function); 24 Expect.isTrue(f is Function);
25 Expect.isTrue(g is Function); 25 Expect.isTrue(g is Function);
(...skipping 26 matching lines...) Expand all
52 f = c.f; 52 f = c.f;
53 g = c.g; 53 g = c.g;
54 Expect.isTrue(f is F); 54 Expect.isTrue(f is F);
55 Expect.isTrue(g is F); 55 Expect.isTrue(g is F);
56 Expect.isTrue(f is F<int>); 56 Expect.isTrue(f is F<int>);
57 Expect.isTrue(g is F<int>); 57 Expect.isTrue(g is F<int>);
58 Expect.isTrue(f is F<bool>); 58 Expect.isTrue(f is F<bool>);
59 Expect.isTrue(g is F<bool>); 59 Expect.isTrue(g is F<bool>);
60 Expect.equals("(dynamic) => dynamic", f.runtimeType.toString()); 60 Expect.equals("(dynamic) => dynamic", f.runtimeType.toString());
61 Expect.equals("(dynamic) => dynamic", g.runtimeType.toString()); 61 Expect.equals("(dynamic) => dynamic", g.runtimeType.toString());
62 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698