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_strong/call_operator_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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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
8 // simple test with no types in signature 7 // simple test with no types in signature
9 class A1 { 8 class A1 {
10 call() => 42; 9 call() => 42;
11 } 10 }
12 11
13 // same test, include return type 12 // same test, include return type
14 class A2 { 13 class A2 {
15 int call() => 35; 14 int call() => 35;
16 } 15 }
17 16
18 class B { 17 class B {
19 call() => 28; 18 call() => 28;
20 } 19 }
21 20
22 // A call() operator can have any arity 21 // A call() operator can have any arity
23 class C { 22 class C {
24 call(arg) => 7 * arg; 23 call(arg) => 7 * arg;
25 } 24 }
26 25
27 // Test named arguments 26 // Test named arguments
28 class D { 27 class D {
29 call([arg=6]) => 7 * arg; 28 call([arg = 6]) => 7 * arg;
30 } 29 }
31 30
32 // Non-trivial method body combination of positional and named. 31 // Non-trivial method body combination of positional and named.
33 class E { 32 class E {
34 String call(String str, {int count: 1}) { 33 String call(String str, {int count: 1}) {
35 StringBuffer buffer = new StringBuffer(); 34 StringBuffer buffer = new StringBuffer();
36 for (var i = 0; i < count; i++) { 35 for (var i = 0; i < count; i++) {
37 buffer.write(str); 36 buffer.write(str);
38 if (i < count - 1) { 37 if (i < count - 1) {
39 buffer.write(":"); 38 buffer.write(":");
(...skipping 23 matching lines...) Expand all
63 var d = new D(); 62 var d = new D();
64 Expect.equals(42, d()); 63 Expect.equals(42, d());
65 Expect.equals(7, d(1)); 64 Expect.equals(7, d(1));
66 Expect.equals(14, d(2)); 65 Expect.equals(14, d(2));
67 Expect.equals(42, d.call()); 66 Expect.equals(42, d.call());
68 Expect.equals(7, d.call(1)); 67 Expect.equals(7, d.call(1));
69 Expect.equals(14, d.call(2)); 68 Expect.equals(14, d.call(2));
70 69
71 var e = new E(); 70 var e = new E();
72 Expect.equals("foo", e("foo")); 71 Expect.equals("foo", e("foo"));
73 Expect.equals("foo:foo", e("foo", count:2)); 72 Expect.equals("foo:foo", e("foo", count: 2));
74 Expect.equals("foo:foo:foo", e("foo", count:3)); 73 Expect.equals("foo:foo:foo", e("foo", count: 3));
75 Expect.equals("foo", e.call("foo")); 74 Expect.equals("foo", e.call("foo"));
76 Expect.equals("foo:foo", e.call("foo", count:2)); 75 Expect.equals("foo:foo", e.call("foo", count: 2));
77 Expect.equals("foo:foo:foo", e.call("foo", count:3)); 76 Expect.equals("foo:foo:foo", e.call("foo", count: 3));
78 77
79 Expect.isTrue(a1 is Function); 78 Expect.isTrue(a1 is Function);
80 Expect.isTrue(e is Function); 79 Expect.isTrue(e is Function);
81 } 80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698