OLD | NEW |
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 library test.services.correction.fix; | 5 library test.services.correction.fix; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; | 9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; |
10 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; | 10 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 ''' | 168 ''' |
169 class Test { | 169 class Test { |
170 final int a; | 170 final int a; |
171 final int b; | 171 final int b; |
172 final int c; | 172 final int c; |
173 Test(this.a, this.b, [this.c]); | 173 Test(this.a, this.b, [this.c]); |
174 } | 174 } |
175 '''); | 175 '''); |
176 } | 176 } |
177 | 177 |
| 178 test_addMissingParameter_function_positional_hasNamed() async { |
| 179 resolveTestUnit(''' |
| 180 test({int a}) {} |
| 181 main() { |
| 182 test(1); |
| 183 } |
| 184 '''); |
| 185 await assertNoFix(DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL); |
| 186 } |
| 187 |
178 test_addMissingParameter_function_positional_hasZero() async { | 188 test_addMissingParameter_function_positional_hasZero() async { |
179 resolveTestUnit(''' | 189 resolveTestUnit(''' |
180 test() {} | 190 test() {} |
181 main() { | 191 main() { |
182 test(1); | 192 test(1); |
183 } | 193 } |
184 '''); | 194 '''); |
185 await assertHasFix( | 195 await assertHasFix( |
186 DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL, | 196 DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL, |
187 ''' | 197 ''' |
188 test([int i]) {} | 198 test([int i]) {} |
189 main() { | 199 main() { |
190 test(1); | 200 test(1); |
191 } | 201 } |
192 '''); | 202 '''); |
193 } | 203 } |
194 | 204 |
| 205 test_addMissingParameter_function_required_hasNamed() async { |
| 206 resolveTestUnit(''' |
| 207 test({int a}) {} |
| 208 main() { |
| 209 test(1); |
| 210 } |
| 211 '''); |
| 212 await assertHasFix( |
| 213 DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, |
| 214 ''' |
| 215 test(int i, {int a}) {} |
| 216 main() { |
| 217 test(1); |
| 218 } |
| 219 '''); |
| 220 } |
| 221 |
195 test_addMissingParameter_function_required_hasOne() async { | 222 test_addMissingParameter_function_required_hasOne() async { |
196 resolveTestUnit(''' | 223 resolveTestUnit(''' |
197 test(int a) {} | 224 test(int a) {} |
198 main() { | 225 main() { |
199 test(1, 2.0); | 226 test(1, 2.0); |
200 } | 227 } |
201 '''); | 228 '''); |
202 await assertHasFix( | 229 await assertHasFix( |
203 DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, | 230 DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, |
204 ''' | 231 ''' |
(...skipping 4414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4619 int offset = resultCode.indexOf(search); | 4646 int offset = resultCode.indexOf(search); |
4620 positions.add(new Position(testFile, offset)); | 4647 positions.add(new Position(testFile, offset)); |
4621 } | 4648 } |
4622 return positions; | 4649 return positions; |
4623 } | 4650 } |
4624 | 4651 |
4625 void _performAnalysis() { | 4652 void _performAnalysis() { |
4626 while (context.performAnalysisTask().hasMoreWork); | 4653 while (context.performAnalysisTask().hasMoreWork); |
4627 } | 4654 } |
4628 } | 4655 } |
OLD | NEW |