| 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/services/completion/local_computer.dart'; | 7 import 'package:analysis_server/src/services/completion/local_computer.dart'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 | 9 |
| 10 import '../../reflective_tests.dart'; | 10 import '../../reflective_tests.dart'; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 } | 201 } |
| 202 | 202 |
| 203 test_MethodDeclaration_parameters_positional() { | 203 test_MethodDeclaration_parameters_positional() { |
| 204 // Block BlockFunctionBody MethodDeclaration | 204 // Block BlockFunctionBody MethodDeclaration |
| 205 addTestSource('class A {Z a(X x, [int y=1]) {^}}'); | 205 addTestSource('class A {Z a(X x, [int y=1]) {^}}'); |
| 206 expect(computeFast(), isTrue); | 206 expect(computeFast(), isTrue); |
| 207 assertSuggestMethod('a', 'A', 'Z'); | 207 assertSuggestMethod('a', 'A', 'Z'); |
| 208 assertSuggestParameter('x', 'X'); | 208 assertSuggestParameter('x', 'X'); |
| 209 assertSuggestParameter('y', 'int'); | 209 assertSuggestParameter('y', 'int'); |
| 210 } | 210 } |
| 211 | |
| 212 test_PrefixedIdentifier() { | |
| 213 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | |
| 214 addTestSource(''' | |
| 215 class A {var b; X _c;} | |
| 216 class X{} | |
| 217 main() {A a; a.^}'''); | |
| 218 expect(computeFast(), isTrue); | |
| 219 // PrefixedIdentifier is handled by InvocationComputer | |
| 220 assertNotSuggested('b'); | |
| 221 assertNotSuggested('_c'); | |
| 222 } | |
| 223 | |
| 224 test_PrefixedIdentifier_interpolation() { | |
| 225 // SimpleIdentifier PrefixedIdentifier InterpolationExpression | |
| 226 addTestSource('main() {String name; print("hello \${name.^}");}'); | |
| 227 expect(computeFast(), isTrue); | |
| 228 // InvocationComputer creates suggestions for prefixed identifiers | |
| 229 assertNotSuggested('name'); | |
| 230 assertNotSuggested('length'); | |
| 231 } | |
| 232 | |
| 233 test_PrefixedIdentifier_prefix() { | |
| 234 // SimpleIdentifier PrefixedIdentifier InterpolationExpression | |
| 235 addTestSource('main() {String name; print("hello \${nam^e.length}");}'); | |
| 236 expect(computeFast(), isTrue); | |
| 237 assertSuggestLocalVariable('name', 'String'); | |
| 238 assertNotSuggested('length'); | |
| 239 } | |
| 240 | |
| 241 test_TopLevelVariableDeclaration_typed_name() { | |
| 242 // SimpleIdentifier VariableDeclaration VariableDeclarationList | |
| 243 // TopLevelVariableDeclaration | |
| 244 addTestSource('class A {} B ^'); | |
| 245 expect(computeFast(), isTrue); | |
| 246 assertNotSuggested('A'); | |
| 247 } | |
| 248 | |
| 249 test_TopLevelVariableDeclaration_untyped_name() { | |
| 250 // SimpleIdentifier VariableDeclaration VariableDeclarationList | |
| 251 // TopLevelVariableDeclaration | |
| 252 addTestSource('class A {} var ^'); | |
| 253 expect(computeFast(), isTrue); | |
| 254 assertNotSuggested('A'); | |
| 255 } | |
| 256 } | 211 } |
| OLD | NEW |