| 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.util; | 5 library test.services.completion.util; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart' as protocol | 9 import 'package:analysis_server/src/protocol.dart' as protocol |
| 10 show Element, ElementKind; | 10 show Element, ElementKind; |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 expect(element.parameters, isNull); | 312 expect(element.parameters, isNull); |
| 313 expect(element.returnType, isNull); | 313 expect(element.returnType, isNull); |
| 314 assertHasNoParameterInfo(cs); | 314 assertHasNoParameterInfo(cs); |
| 315 return cs; | 315 return cs; |
| 316 } | 316 } |
| 317 | 317 |
| 318 CompletionSuggestion assertSuggestLibraryPrefix(String prefix, | 318 CompletionSuggestion assertSuggestLibraryPrefix(String prefix, |
| 319 [int relevance = DART_RELEVANCE_DEFAULT, | 319 [int relevance = DART_RELEVANCE_DEFAULT, |
| 320 CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) { | 320 CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) { |
| 321 // Library prefix should only be suggested by ImportedComputer | 321 // Library prefix should only be suggested by ImportedComputer |
| 322 if (computer is ImportedComputer) { | 322 return assertNotSuggested(prefix); |
| 323 CompletionSuggestion cs = | |
| 324 assertSuggest(prefix, csKind: kind, relevance: relevance); | |
| 325 protocol.Element element = cs.element; | |
| 326 expect(element, isNotNull); | |
| 327 expect(element.kind, equals(protocol.ElementKind.LIBRARY)); | |
| 328 expect(element.parameters, isNull); | |
| 329 expect(element.returnType, isNull); | |
| 330 assertHasNoParameterInfo(cs); | |
| 331 return cs; | |
| 332 } else { | |
| 333 return assertNotSuggested(prefix); | |
| 334 } | |
| 335 } | 323 } |
| 336 | 324 |
| 337 CompletionSuggestion assertSuggestMethod( | 325 CompletionSuggestion assertSuggestMethod( |
| 338 String name, String declaringType, String returnType, | 326 String name, String declaringType, String returnType, |
| 339 {int relevance: DART_RELEVANCE_DEFAULT, | 327 {int relevance: DART_RELEVANCE_DEFAULT, |
| 340 CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION, | 328 CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION, |
| 341 bool isDeprecated: false}) { | 329 bool isDeprecated: false}) { |
| 342 CompletionSuggestion cs = assertSuggest(name, | 330 CompletionSuggestion cs = assertSuggest(name, |
| 343 csKind: kind, relevance: relevance, isDeprecated: isDeprecated); | 331 csKind: kind, relevance: relevance, isDeprecated: isDeprecated); |
| 344 expect(cs.declaringType, equals(declaringType)); | 332 expect(cs.declaringType, equals(declaringType)); |
| (...skipping 2722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3067 assertNotSuggested('bar2'); | 3055 assertNotSuggested('bar2'); |
| 3068 assertNotSuggested('_B'); | 3056 assertNotSuggested('_B'); |
| 3069 assertSuggestLocalClass('Y'); | 3057 assertSuggestLocalClass('Y'); |
| 3070 assertSuggestLocalClass('C'); | 3058 assertSuggestLocalClass('C'); |
| 3071 assertSuggestLocalVariable('f', null); | 3059 assertSuggestLocalVariable('f', null); |
| 3072 assertNotSuggested('x'); | 3060 assertNotSuggested('x'); |
| 3073 assertNotSuggested('e'); | 3061 assertNotSuggested('e'); |
| 3074 }); | 3062 }); |
| 3075 } | 3063 } |
| 3076 } | 3064 } |
| OLD | NEW |