| 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.invocation; | 5 library test.services.completion.invocation; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 10 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 10 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 return computeFull((bool result) { | 212 return computeFull((bool result) { |
| 213 // Suggested by StaticMemberContributor | 213 // Suggested by StaticMemberContributor |
| 214 assertNotSuggested('instance'); | 214 assertNotSuggested('instance'); |
| 215 }); | 215 }); |
| 216 } | 216 } |
| 217 | 217 |
| 218 test_libraryPrefix() { | 218 test_libraryPrefix() { |
| 219 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 219 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
| 220 addTestSource('import "dart:async" as bar; foo() {bar.^}'); | 220 addTestSource('import "dart:async" as bar; foo() {bar.^}'); |
| 221 return computeFull((bool result) { | 221 return computeFull((bool result) { |
| 222 assertSuggestClass('Future'); | 222 // Suggested by LibraryMemberContributor |
| 223 assertNotSuggested('Future'); |
| 223 assertNotSuggested('loadLibrary'); | 224 assertNotSuggested('loadLibrary'); |
| 224 }); | 225 }); |
| 225 } | 226 } |
| 226 | 227 |
| 227 test_libraryPrefix2() { | 228 test_libraryPrefix2() { |
| 228 // SimpleIdentifier MethodInvocation ExpressionStatement | 229 // SimpleIdentifier MethodInvocation ExpressionStatement |
| 229 addTestSource('import "dart:async" as bar; foo() {bar.^ print("f")}'); | 230 addTestSource('import "dart:async" as bar; foo() {bar.^ print("f")}'); |
| 230 return computeFull((bool result) { | 231 return computeFull((bool result) { |
| 231 assertSuggestClass('Future'); | 232 // Suggested by LibraryMemberContributor |
| 233 assertNotSuggested('Future'); |
| 232 }); | 234 }); |
| 233 } | 235 } |
| 234 | 236 |
| 235 test_libraryPrefix3() { | 237 test_libraryPrefix3() { |
| 236 // SimpleIdentifier MethodInvocation ExpressionStatement | 238 // SimpleIdentifier MethodInvocation ExpressionStatement |
| 237 addTestSource('import "dart:async" as bar; foo() {new bar.F^ print("f")}'); | 239 addTestSource('import "dart:async" as bar; foo() {new bar.F^ print("f")}'); |
| 238 return computeFull((bool result) { | 240 return computeFull((bool result) { |
| 239 assertSuggestConstructor('Future'); | 241 // Suggested by LibraryMemberContributor |
| 240 assertSuggestConstructor('Future.delayed'); | 242 assertNotSuggested('Future'); |
| 243 assertNotSuggested('Future.delayed'); |
| 241 }); | 244 }); |
| 242 } | 245 } |
| 243 | 246 |
| 244 test_libraryPrefix_deferred() { | 247 test_libraryPrefix_deferred() { |
| 245 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 248 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
| 246 addTestSource('import "dart:async" deferred as bar; foo() {bar.^}'); | 249 addTestSource('import "dart:async" deferred as bar; foo() {bar.^}'); |
| 247 return computeFull((bool result) { | 250 return computeFull((bool result) { |
| 248 assertSuggestClass('Future'); | 251 // Suggested by LibraryMemberContributor |
| 249 assertSuggestFunction('loadLibrary', 'Future<dynamic>'); | 252 assertNotSuggested('Future'); |
| 253 assertNotSuggested('loadLibrary'); |
| 250 }); | 254 }); |
| 251 } | 255 } |
| 252 | 256 |
| 253 test_libraryPrefix_with_exports() { | 257 test_libraryPrefix_with_exports() { |
| 254 addSource('/libA.dart', 'library libA; class A { }'); | 258 addSource('/libA.dart', 'library libA; class A { }'); |
| 255 addSource('/libB.dart', 'library libB; export "/libA.dart"; class B { }'); | 259 addSource('/libB.dart', 'library libB; export "/libA.dart"; class B { }'); |
| 256 addTestSource('import "/libB.dart" as foo; main() {foo.^} class C { }'); | 260 addTestSource('import "/libB.dart" as foo; main() {foo.^} class C { }'); |
| 257 computeFast(); | 261 computeFast(); |
| 258 return computeFull((bool result) { | 262 return computeFull((bool result) { |
| 259 assertSuggestClass('B'); | 263 // Suggested by LibraryMemberContributor |
| 260 assertSuggestClass('A'); | 264 assertNotSuggested('B'); |
| 265 assertNotSuggested('A'); |
| 261 }); | 266 }); |
| 262 } | 267 } |
| 263 | 268 |
| 264 test_local() { | 269 test_local() { |
| 265 addTestSource('foo() {String x = "bar"; x.^}'); | 270 addTestSource('foo() {String x = "bar"; x.^}'); |
| 266 return computeFull((bool result) { | 271 return computeFull((bool result) { |
| 267 assertSuggestGetter('length', 'int'); | 272 assertSuggestGetter('length', 'int'); |
| 268 }); | 273 }); |
| 269 } | 274 } |
| 270 | 275 |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 assertNotSuggested('ms2'); | 664 assertNotSuggested('ms2'); |
| 660 assertSuggestInvocationMethod('m', 'C2', null, | 665 assertSuggestInvocationMethod('m', 'C2', null, |
| 661 relevance: DART_RELEVANCE_HIGH); | 666 relevance: DART_RELEVANCE_HIGH); |
| 662 assertNotSuggested('fi3'); | 667 assertNotSuggested('fi3'); |
| 663 assertNotSuggested('fs3'); | 668 assertNotSuggested('fs3'); |
| 664 assertNotSuggested('mi3'); | 669 assertNotSuggested('mi3'); |
| 665 assertNotSuggested('ms3'); | 670 assertNotSuggested('ms3'); |
| 666 }); | 671 }); |
| 667 } | 672 } |
| 668 } | 673 } |
| OLD | NEW |