| 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.completion.dart.local; | 5 library test.services.completion.dart.local; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/protocol_server.dart'; | 7 import 'package:analysis_server/src/protocol_server.dart'; |
| 8 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 8 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
| 9 import 'package:analysis_server/src/services/completion/local_computer.dart'; | 9 import 'package:analysis_server/src/services/completion/local_computer.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 break ^ | 218 break ^ |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 '''); | 222 '''); |
| 223 expect(computeFast(), isTrue); | 223 expect(computeFast(), isTrue); |
| 224 assertSuggestLabel('foo'); | 224 assertSuggestLabel('foo'); |
| 225 assertSuggestLabel('bar'); | 225 assertSuggestLabel('bar'); |
| 226 } | 226 } |
| 227 | 227 |
| 228 test_constructor_parameters_mixed_required_and_named() { |
| 229 addTestSource('class A {A(x, {int y}) {^}}'); |
| 230 expect(computeFast(), isTrue); |
| 231 assertSuggestParameter('x', null); |
| 232 assertSuggestParameter('y', 'int'); |
| 233 } |
| 234 |
| 235 test_constructor_parameters_mixed_required_and_positional() { |
| 236 addTestSource('class A {A(x, [int y]) {^}}'); |
| 237 expect(computeFast(), isTrue); |
| 238 assertSuggestParameter('x', null); |
| 239 assertSuggestParameter('y', 'int'); |
| 240 } |
| 241 |
| 242 test_constructor_parameters_named() { |
| 243 addTestSource('class A {A({x, int y}) {^}}'); |
| 244 expect(computeFast(), isTrue); |
| 245 assertSuggestParameter('x', null); |
| 246 assertSuggestParameter('y', 'int'); |
| 247 } |
| 248 |
| 249 test_constructor_parameters_positional() { |
| 250 addTestSource('class A {A([x, int y]) {^}}'); |
| 251 expect(computeFast(), isTrue); |
| 252 assertSuggestParameter('x', null); |
| 253 assertSuggestParameter('y', 'int'); |
| 254 } |
| 255 |
| 256 test_constructor_parameters_required() { |
| 257 addTestSource('class A {A(x, int y) {^}}'); |
| 258 expect(computeFast(), isTrue); |
| 259 assertSuggestParameter('x', null); |
| 260 assertSuggestParameter('y', 'int'); |
| 261 } |
| 262 |
| 228 test_continue_from_loop_to_switch() { | 263 test_continue_from_loop_to_switch() { |
| 229 addTestSource(''' | 264 addTestSource(''' |
| 230 void main() { | 265 void main() { |
| 231 switch (x) { | 266 switch (x) { |
| 232 foo: case 1: | 267 foo: case 1: |
| 233 break; | 268 break; |
| 234 bar: case 2: | 269 bar: case 2: |
| 235 while (true) { | 270 while (true) { |
| 236 continue ^; | 271 continue ^; |
| 237 } | 272 } |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 assertSuggestLocalMethod('m', 'A', 'void'); | 727 assertSuggestLocalMethod('m', 'A', 'void'); |
| 693 expect(suggestion.parameterNames, hasLength(2)); | 728 expect(suggestion.parameterNames, hasLength(2)); |
| 694 expect(suggestion.parameterNames[0], 'x'); | 729 expect(suggestion.parameterNames[0], 'x'); |
| 695 expect(suggestion.parameterTypes[0], 'dynamic'); | 730 expect(suggestion.parameterTypes[0], 'dynamic'); |
| 696 expect(suggestion.parameterNames[1], 'y'); | 731 expect(suggestion.parameterNames[1], 'y'); |
| 697 expect(suggestion.parameterTypes[1], 'int'); | 732 expect(suggestion.parameterTypes[1], 'int'); |
| 698 expect(suggestion.requiredParameterCount, 2); | 733 expect(suggestion.requiredParameterCount, 2); |
| 699 expect(suggestion.hasNamedParameters, false); | 734 expect(suggestion.hasNamedParameters, false); |
| 700 } | 735 } |
| 701 } | 736 } |
| OLD | NEW |