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

Side by Side Diff: tests/language/named_parameters_with_conversions_test.dart

Issue 2763823002: Move spaces from before comments to within comments (Closed)
Patch Set: Fix comments Created 3 years, 9 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 // 4 //
5 // Test named arguments work as expected regardless of whether the function or 5 // Test named arguments work as expected regardless of whether the function or
6 // method is called via function call syntax or method call syntax. 6 // method is called via function call syntax or method call syntax.
7 // VMOptions=--optimization-counter-threshold=10 --no-background-compilation 7 // VMOptions=--optimization-counter-threshold=10 --no-background-compilation
8 8
9 import "package:expect/expect.dart"; 9 import "package:expect/expect.dart";
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 a.foo(''); 91 a.foo('');
92 a.foo('a', 111); 92 a.foo('a', 111);
93 a.foo('ab', 111, 222); 93 a.foo('ab', 111, 222);
94 a.foo2('a', a: 111); 94 a.foo2('a', a: 111);
95 a.foo2('b', b: 222); 95 a.foo2('b', b: 222);
96 a.foo2('ab', a: 111, b: 222); 96 a.foo2('ab', a: 111, b: 222);
97 a.foo2('ab', b: 222, a: 111); 97 a.foo2('ab', b: 222, a: 111);
98 98
99 Expect.equals(7, a.calls); 99 Expect.equals(7, a.calls);
100 100
101 checkException(() => a.foo()); // Too few arguments. 101 checkException(() => a.foo()); // Too few arguments.
102 checkException(() => a.foo('abc', 1, 2, 3)); // Too many arguments. 102 checkException(() => a.foo('abc', 1, 2, 3)); // Too many arguments.
103 checkException(() => a.foo2('c', c: 1)); // Bad name. 103 checkException(() => a.foo2('c', c: 1)); // Bad name.
104 checkException(() => a.foo2('c', a:111, c: 1)); // Bad name. 104 checkException(() => a.foo2('c', a:111, c: 1)); // Bad name.
sra1 2017/03/21 03:28:14 fix
105 105
106 Expect.equals(7, a.calls); 106 Expect.equals(7, a.calls);
107 } 107 }
108 108
109 static testFunctionCallSyntax(a) { 109 static testFunctionCallSyntax(a) {
110 var f = a.foo; 110 var f = a.foo;
111 var f2 = a.foo2; 111 var f2 = a.foo2;
112 f(''); 112 f('');
113 f('a', 111); 113 f('a', 111);
114 f('ab', 111, 222); 114 f('ab', 111, 222);
115 f2('a', a: 111); 115 f2('a', a: 111);
116 f2('b', b: 222); 116 f2('b', b: 222);
117 f2('ab', a: 111, b: 222); 117 f2('ab', a: 111, b: 222);
118 f2('ab', b: 222, a: 111); 118 f2('ab', b: 222, a: 111);
119 119
120 Expect.equals(7, a.calls); 120 Expect.equals(7, a.calls);
121 121
122 checkException(() => f()); // Too few arguments. 122 checkException(() => f()); // Too few arguments.
123 checkException(() => f('abc', 1, 2, 3)); // Too many arguments. 123 checkException(() => f('abc', 1, 2, 3)); // Too many arguments.
124 checkException(() => f2('c', c: 1)); // Bad name. 124 checkException(() => f2('c', c: 1)); // Bad name.
125 checkException(() => f2('c', a: 111, c: 1)); // Bad name. 125 checkException(() => f2('c', a: 111, c: 1)); // Bad name.
126 126
127 Expect.equals(7, a.calls); 127 Expect.equals(7, a.calls);
128 } 128 }
129 129
130 static testMain() { 130 static testMain() {
131 // 'Plain' calls where the method/field syntax matches the object. 131 // 'Plain' calls where the method/field syntax matches the object.
132 testMethodCallSyntax(new HasMethod()); 132 testMethodCallSyntax(new HasMethod());
133 testFunctionCallSyntax(new HasField()); 133 testFunctionCallSyntax(new HasField());
134 134
135 // 'Conversion' calls where method/field call syntax does not match the 135 // 'Conversion' calls where method/field call syntax does not match the
136 // object. 136 // object.
137 testMethodCallSyntax(new HasField()); 137 testMethodCallSyntax(new HasField());
138 testFunctionCallSyntax(new HasMethod()); 138 testFunctionCallSyntax(new HasMethod());
139 } 139 }
140 } 140 }
141 141
142 main() { 142 main() {
143 for (var i = 0; i < 20; i++) { 143 for (var i = 0; i < 20; i++) {
144 NamedParametersWithConversionsTest.testMain(); 144 NamedParametersWithConversionsTest.testMain();
145 } 145 }
146 } 146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698