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 4197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4208 ['double', 'num', 'Object', 'Comparable'])); | 4208 ['double', 'num', 'Object', 'Comparable'])); |
4209 _assertLinkedGroup(change.linkedEditGroups[index++], ['d,']); | 4209 _assertLinkedGroup(change.linkedEditGroups[index++], ['d,']); |
4210 _assertLinkedGroup( | 4210 _assertLinkedGroup( |
4211 change.linkedEditGroups[index++], | 4211 change.linkedEditGroups[index++], |
4212 ['String s'], | 4212 ['String s'], |
4213 expectedSuggestions( | 4213 expectedSuggestions( |
4214 LinkedEditSuggestionKind.TYPE, ['String', 'Object', 'Comparable'])); | 4214 LinkedEditSuggestionKind.TYPE, ['String', 'Object', 'Comparable'])); |
4215 _assertLinkedGroup(change.linkedEditGroups[index++], ['s)']); | 4215 _assertLinkedGroup(change.linkedEditGroups[index++], ['s)']); |
4216 } | 4216 } |
4217 | 4217 |
| 4218 test_undefinedMethod_createUnqualified_parameters_named() async { |
| 4219 resolveTestUnit(''' |
| 4220 class A { |
| 4221 main() { |
| 4222 myUndefinedMethod(0, bbb: 1.0, ccc: '2'); |
| 4223 } |
| 4224 } |
| 4225 '''); |
| 4226 await assertHasFix( |
| 4227 DartFixKind.CREATE_METHOD, |
| 4228 ''' |
| 4229 class A { |
| 4230 main() { |
| 4231 myUndefinedMethod(0, bbb: 1.0, ccc: '2'); |
| 4232 } |
| 4233 |
| 4234 void myUndefinedMethod(int i, {double bbb, String ccc}) { |
| 4235 } |
| 4236 } |
| 4237 '''); |
| 4238 // linked positions |
| 4239 int index = 0; |
| 4240 _assertLinkedGroup( |
| 4241 change.linkedEditGroups[index++], ['void myUndefinedMethod(']); |
| 4242 _assertLinkedGroup(change.linkedEditGroups[index++], |
| 4243 ['myUndefinedMethod(0', 'myUndefinedMethod(int']); |
| 4244 _assertLinkedGroup( |
| 4245 change.linkedEditGroups[index++], |
| 4246 ['int i'], |
| 4247 expectedSuggestions(LinkedEditSuggestionKind.TYPE, |
| 4248 ['int', 'num', 'Object', 'Comparable'])); |
| 4249 _assertLinkedGroup(change.linkedEditGroups[index++], ['i,']); |
| 4250 _assertLinkedGroup( |
| 4251 change.linkedEditGroups[index++], |
| 4252 ['double bbb'], |
| 4253 expectedSuggestions(LinkedEditSuggestionKind.TYPE, |
| 4254 ['double', 'num', 'Object', 'Comparable'])); |
| 4255 _assertLinkedGroup( |
| 4256 change.linkedEditGroups[index++], |
| 4257 ['String ccc'], |
| 4258 expectedSuggestions( |
| 4259 LinkedEditSuggestionKind.TYPE, ['String', 'Object', 'Comparable'])); |
| 4260 } |
| 4261 |
4218 test_undefinedMethod_createUnqualified_returnType() async { | 4262 test_undefinedMethod_createUnqualified_returnType() async { |
4219 resolveTestUnit(''' | 4263 resolveTestUnit(''' |
4220 class A { | 4264 class A { |
4221 main() { | 4265 main() { |
4222 int v = myUndefinedMethod(); | 4266 int v = myUndefinedMethod(); |
4223 } | 4267 } |
4224 } | 4268 } |
4225 '''); | 4269 '''); |
4226 await assertHasFix( | 4270 await assertHasFix( |
4227 DartFixKind.CREATE_METHOD, | 4271 DartFixKind.CREATE_METHOD, |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4646 int offset = resultCode.indexOf(search); | 4690 int offset = resultCode.indexOf(search); |
4647 positions.add(new Position(testFile, offset)); | 4691 positions.add(new Position(testFile, offset)); |
4648 } | 4692 } |
4649 return positions; | 4693 return positions; |
4650 } | 4694 } |
4651 | 4695 |
4652 void _performAnalysis() { | 4696 void _performAnalysis() { |
4653 while (context.performAnalysisTask().hasMoreWork); | 4697 while (context.performAnalysisTask().hasMoreWork); |
4654 } | 4698 } |
4655 } | 4699 } |
OLD | NEW |