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

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

Issue 1514263004: extract LabelContributor from local reference contributor (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years 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
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.util; 5 library test.services.completion.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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 expect(element, isNotNull); 298 expect(element, isNotNull);
299 expect(element.kind, equals(protocol.ElementKind.GETTER)); 299 expect(element.kind, equals(protocol.ElementKind.GETTER));
300 expect(element.name, equals(name)); 300 expect(element.name, equals(name));
301 expect(element.parameters, isNull); 301 expect(element.parameters, isNull);
302 expect(element.returnType, 302 expect(element.returnType,
303 equals(returnType != null ? returnType : 'dynamic')); 303 equals(returnType != null ? returnType : 'dynamic'));
304 assertHasNoParameterInfo(cs); 304 assertHasNoParameterInfo(cs);
305 return cs; 305 return cs;
306 } 306 }
307 307
308 CompletionSuggestion assertSuggestLabel(String name,
309 [int relevance = DART_RELEVANCE_DEFAULT,
310 CompletionSuggestionKind kind = CompletionSuggestionKind.IDENTIFIER]) {
311 CompletionSuggestion cs =
312 assertSuggest(name, csKind: kind, relevance: relevance);
313 expect(cs.returnType, isNull);
314 protocol.Element element = cs.element;
315 expect(element, isNotNull);
316 expect(element.flags, 0);
317 expect(element.kind, equals(protocol.ElementKind.LABEL));
318 expect(element.name, equals(name));
319 expect(element.parameters, isNull);
320 expect(element.returnType, isNull);
321 assertHasNoParameterInfo(cs);
322 return cs;
323 }
324
325 CompletionSuggestion assertSuggestLibraryPrefix(String prefix, 308 CompletionSuggestion assertSuggestLibraryPrefix(String prefix,
326 [int relevance = DART_RELEVANCE_DEFAULT, 309 [int relevance = DART_RELEVANCE_DEFAULT,
327 CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) { 310 CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) {
328 // Library prefix should only be suggested by ImportedReferenceContributor 311 // Library prefix should only be suggested by ImportedReferenceContributor
329 return assertNotSuggested(prefix); 312 return assertNotSuggested(prefix);
330 } 313 }
331 314
332 CompletionSuggestion assertSuggestMethod( 315 CompletionSuggestion assertSuggestMethod(
333 String name, String declaringType, String returnType, 316 String name, String declaringType, String returnType,
334 {int relevance: DART_RELEVANCE_DEFAULT, 317 {int relevance: DART_RELEVANCE_DEFAULT,
(...skipping 4351 matching lines...) Expand 10 before | Expand all | Expand 10 after
4686 assertNotSuggested('bar2'); 4669 assertNotSuggested('bar2');
4687 assertNotSuggested('_B'); 4670 assertNotSuggested('_B');
4688 assertSuggestLocalClass('Y'); 4671 assertSuggestLocalClass('Y');
4689 assertSuggestLocalClass('C'); 4672 assertSuggestLocalClass('C');
4690 assertSuggestLocalVariable('f', null); 4673 assertSuggestLocalVariable('f', null);
4691 assertNotSuggested('x'); 4674 assertNotSuggested('x');
4692 assertNotSuggested('e'); 4675 assertNotSuggested('e');
4693 }); 4676 });
4694 } 4677 }
4695 } 4678 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698