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

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

Issue 1267203002: add location to suggestions from local file (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 | « pkg/analysis_server/test/services/completion/imported_reference_contributor_test.dart ('k') | 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.local; 5 library test.services.completion.dart.local;
6 6
7 import 'package:analysis_server/src/protocol.dart' as protocol 7 import 'package:analysis_server/src/protocol.dart' as protocol
8 show Element, ElementKind; 8 show Element, ElementKind;
9 import 'package:analysis_server/src/protocol.dart' hide Element, ElementKind; 9 import 'package:analysis_server/src/protocol.dart' hide Element, ElementKind;
10 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart'; 10 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart';
11 import 'package:analysis_server/src/services/completion/local_reference_contribu tor.dart'; 11 import 'package:analysis_server/src/services/completion/local_reference_contribu tor.dart';
12 import 'package:test_reflective_loader/test_reflective_loader.dart'; 12 import 'package:test_reflective_loader/test_reflective_loader.dart';
13 import 'package:unittest/unittest.dart'; 13 import 'package:unittest/unittest.dart';
14 14
15 import 'completion_test_util.dart'; 15 import 'completion_test_util.dart';
16 16
17 main() { 17 main() {
18 groupSep = ' | '; 18 groupSep = ' | ';
19 defineReflectiveTests(LocalReferenceContributorTest); 19 defineReflectiveTests(LocalReferenceContributorTest);
20 } 20 }
21 21
22 @reflectiveTest 22 @reflectiveTest
23 class LocalReferenceContributorTest extends AbstractSelectorSuggestionTest { 23 class LocalReferenceContributorTest extends AbstractSelectorSuggestionTest {
24 @override 24 @override
25 CompletionSuggestion assertSuggestLocalClass(String name, 25 CompletionSuggestion assertSuggestLocalClass(String name,
26 {CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION, 26 {CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION,
27 int relevance: DART_RELEVANCE_DEFAULT, bool isDeprecated: false}) { 27 int relevance: DART_RELEVANCE_DEFAULT, bool isDeprecated: false,
28 String elemFile, int elemOffset}) {
28 return assertSuggestClass(name, 29 return assertSuggestClass(name,
29 kind: kind, relevance: relevance, isDeprecated: isDeprecated); 30 elemFile: elemFile,
31 elemOffset: elemOffset,
32 isDeprecated: isDeprecated,
33 kind: kind,
34 relevance: relevance);
30 } 35 }
31 36
32 @override 37 @override
33 CompletionSuggestion assertSuggestLocalClassTypeAlias(String name, 38 CompletionSuggestion assertSuggestLocalClassTypeAlias(String name,
34 {int relevance: DART_RELEVANCE_DEFAULT}) { 39 {int relevance: DART_RELEVANCE_DEFAULT}) {
35 return assertSuggestClassTypeAlias(name, relevance); 40 return assertSuggestClassTypeAlias(name, relevance);
36 } 41 }
37 42
38 @override 43 @override
39 CompletionSuggestion assertSuggestLocalConstructor(String name) { 44 CompletionSuggestion assertSuggestLocalConstructor(String name,
40 return assertSuggestConstructor(name); 45 {int elemOffset}) {
46 return assertSuggestConstructor(name, elemOffset: elemOffset);
41 } 47 }
42 48
43 @override 49 @override
44 CompletionSuggestion assertSuggestLocalField(String name, String type, 50 CompletionSuggestion assertSuggestLocalField(String name, String type,
45 {int relevance: DART_RELEVANCE_LOCAL_FIELD, bool deprecated: false}) { 51 {int relevance: DART_RELEVANCE_LOCAL_FIELD, bool deprecated: false}) {
46 return assertSuggestField(name, type, 52 return assertSuggestField(name, type,
47 relevance: relevance, isDeprecated: deprecated); 53 relevance: relevance, isDeprecated: deprecated);
48 } 54 }
49 55
50 @override 56 @override
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 test_InstanceCreationExpression() { 601 test_InstanceCreationExpression() {
596 addTestSource(''' 602 addTestSource('''
597 class A {foo(){var f; {var x;}}} 603 class A {foo(){var f; {var x;}}}
598 class B {B(this.x, [String boo]) { } int x;} 604 class B {B(this.x, [String boo]) { } int x;}
599 class C {C.bar({boo: 'hoo', int z: 0}) { } } 605 class C {C.bar({boo: 'hoo', int z: 0}) { } }
600 main() {new ^ String x = "hello";}'''); 606 main() {new ^ String x = "hello";}''');
601 computeFast(); 607 computeFast();
602 return computeFull((bool result) { 608 return computeFull((bool result) {
603 CompletionSuggestion suggestion; 609 CompletionSuggestion suggestion;
604 610
605 suggestion = assertSuggestLocalConstructor('A'); 611 suggestion = assertSuggestLocalConstructor('A', elemOffset: -1);
606 expect(suggestion.element.parameters, '()'); 612 expect(suggestion.element.parameters, '()');
607 expect(suggestion.element.returnType, 'A'); 613 expect(suggestion.element.returnType, 'A');
608 expect(suggestion.declaringType, 'A'); 614 expect(suggestion.declaringType, 'A');
609 expect(suggestion.parameterNames, hasLength(0)); 615 expect(suggestion.parameterNames, hasLength(0));
610 expect(suggestion.requiredParameterCount, 0); 616 expect(suggestion.requiredParameterCount, 0);
611 expect(suggestion.hasNamedParameters, false); 617 expect(suggestion.hasNamedParameters, false);
612 618
613 suggestion = assertSuggestLocalConstructor('B'); 619 suggestion = assertSuggestLocalConstructor('B');
614 expect(suggestion.element.parameters, '(int x, [String boo])'); 620 expect(suggestion.element.parameters, '(int x, [String boo])');
615 expect(suggestion.element.returnType, 'B'); 621 expect(suggestion.element.returnType, 'B');
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 expect(computeFast(), isTrue); 788 expect(computeFast(), isTrue);
783 assertSuggestMethod('m', 'B', null, relevance: DART_RELEVANCE_LOCAL_METHOD); 789 assertSuggestMethod('m', 'B', null, relevance: DART_RELEVANCE_LOCAL_METHOD);
784 } 790 }
785 791
786 test_shadowed_name() { 792 test_shadowed_name() {
787 addTestSource('var a; class A { var a; m() { ^ } }'); 793 addTestSource('var a; class A { var a; m() { ^ } }');
788 expect(computeFast(), isTrue); 794 expect(computeFast(), isTrue);
789 assertSuggestLocalField('a', null); 795 assertSuggestLocalField('a', null);
790 } 796 }
791 } 797 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/services/completion/imported_reference_contributor_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698