Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart

Issue 1932003002: If the expected 'returnType' is 'null', just do not check it. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.util; 5 library test.services.completion.dart.util;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol 9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol
10 show Element, ElementKind; 10 show Element, ElementKind;
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 String importUri}) { 255 String importUri}) {
256 CompletionSuggestion cs = assertSuggest(name, 256 CompletionSuggestion cs = assertSuggest(name,
257 csKind: kind, 257 csKind: kind,
258 relevance: relevance, 258 relevance: relevance,
259 importUri: importUri, 259 importUri: importUri,
260 isDeprecated: isDeprecated); 260 isDeprecated: isDeprecated);
261 if (returnType != null) { 261 if (returnType != null) {
262 expect(cs.returnType, returnType); 262 expect(cs.returnType, returnType);
263 } else if (isNullExpectedReturnTypeConsideredDynamic) { 263 } else if (isNullExpectedReturnTypeConsideredDynamic) {
264 expect(cs.returnType, 'dynamic'); 264 expect(cs.returnType, 'dynamic');
265 } else {
266 expect(cs.returnType, isNull);
267 } 265 }
268 protocol.Element element = cs.element; 266 protocol.Element element = cs.element;
269 expect(element, isNotNull); 267 expect(element, isNotNull);
270 expect(element.kind, equals(protocol.ElementKind.FUNCTION)); 268 expect(element.kind, equals(protocol.ElementKind.FUNCTION));
271 expect(element.name, equals(name)); 269 expect(element.name, equals(name));
272 expect(element.isDeprecated, equals(isDeprecated)); 270 expect(element.isDeprecated, equals(isDeprecated));
273 String param = element.parameters; 271 String param = element.parameters;
274 expect(param, isNotNull); 272 expect(param, isNotNull);
275 expect(param[0], equals('(')); 273 expect(param[0], equals('('));
276 expect(param[param.length - 1], equals(')')); 274 expect(param[param.length - 1], equals(')'));
277 if (returnType != null) { 275 if (returnType != null) {
278 expect(element.returnType, returnType); 276 expect(element.returnType, returnType);
279 } else if (isNullExpectedReturnTypeConsideredDynamic) { 277 } else if (isNullExpectedReturnTypeConsideredDynamic) {
280 expect(element.returnType, 'dynamic'); 278 expect(element.returnType, 'dynamic');
281 } else {
282 expect(element.returnType, isNull);
283 } 279 }
284 assertHasParameterInfo(cs); 280 assertHasParameterInfo(cs);
285 return cs; 281 return cs;
286 } 282 }
287 283
288 CompletionSuggestion assertSuggestFunctionTypeAlias( 284 CompletionSuggestion assertSuggestFunctionTypeAlias(
289 String name, String returnType, 285 String name, String returnType,
290 {bool isDeprecated: false, 286 {bool isDeprecated: false,
291 int relevance: DART_RELEVANCE_DEFAULT, 287 int relevance: DART_RELEVANCE_DEFAULT,
292 CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION, 288 CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 CompletionSuggestion assertSuggestTopLevelVar(String name, String returnType, 408 CompletionSuggestion assertSuggestTopLevelVar(String name, String returnType,
413 {int relevance: DART_RELEVANCE_DEFAULT, 409 {int relevance: DART_RELEVANCE_DEFAULT,
414 CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION, 410 CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION,
415 String importUri}) { 411 String importUri}) {
416 CompletionSuggestion cs = assertSuggest(name, 412 CompletionSuggestion cs = assertSuggest(name,
417 csKind: kind, relevance: relevance, importUri: importUri); 413 csKind: kind, relevance: relevance, importUri: importUri);
418 if (returnType != null) { 414 if (returnType != null) {
419 expect(cs.returnType, returnType); 415 expect(cs.returnType, returnType);
420 } else if (isNullExpectedReturnTypeConsideredDynamic) { 416 } else if (isNullExpectedReturnTypeConsideredDynamic) {
421 expect(cs.returnType, 'dynamic'); 417 expect(cs.returnType, 'dynamic');
422 } else {
423 expect(cs.returnType, isNull);
424 } 418 }
425 protocol.Element element = cs.element; 419 protocol.Element element = cs.element;
426 expect(element, isNotNull); 420 expect(element, isNotNull);
427 expect(element.kind, equals(protocol.ElementKind.TOP_LEVEL_VARIABLE)); 421 expect(element.kind, equals(protocol.ElementKind.TOP_LEVEL_VARIABLE));
428 expect(element.name, equals(name)); 422 expect(element.name, equals(name));
429 expect(element.parameters, isNull); 423 expect(element.parameters, isNull);
430 if (returnType != null) { 424 if (returnType != null) {
431 expect(element.returnType, returnType); 425 expect(element.returnType, returnType);
432 } else if (isNullExpectedReturnTypeConsideredDynamic) { 426 } else if (isNullExpectedReturnTypeConsideredDynamic) {
433 expect(element.returnType, 'dynamic'); 427 expect(element.returnType, 'dynamic');
434 } else {
435 expect(element.returnType, isNull);
436 } 428 }
437 assertHasNoParameterInfo(cs); 429 assertHasNoParameterInfo(cs);
438 return cs; 430 return cs;
439 } 431 }
440 432
441 /** 433 /**
442 * Return a [Future] that completes with the containing library information 434 * Return a [Future] that completes with the containing library information
443 * after it is accessible via [context.getLibrariesContaining]. 435 * after it is accessible via [context.getLibrariesContaining].
444 */ 436 */
445 Future computeLibrariesContaining([int times = 200]) { 437 Future computeLibrariesContaining([int times = 200]) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 } 559 }
568 560
569 @override 561 @override
570 void setUp() { 562 void setUp() {
571 super.setUp(); 563 super.setUp();
572 index = createMemoryIndex(); 564 index = createMemoryIndex();
573 searchEngine = new SearchEngineImpl(index); 565 searchEngine = new SearchEngineImpl(index);
574 contributor = createContributor(); 566 contributor = createContributor();
575 } 567 }
576 } 568 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698