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

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

Issue 489813002: include inherited members in invocation suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/suggestion_builder.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.invocation; 5 library test.services.completion.invocation;
6 6
7 7
8 import 'package:analysis_server/src/services/completion/invocation_computer.dart '; 8 import 'package:analysis_server/src/services/completion/invocation_computer.dart ';
9 import 'package:analysis_testing/reflective_tests.dart'; 9 import 'package:analysis_testing/reflective_tests.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
11 11
12 import 'completion_test_util.dart'; 12 import 'completion_test_util.dart';
13 13
14 main() { 14 main() {
15 groupSep = ' | '; 15 groupSep = ' | ';
16 runReflectiveTests(InvocationComputerTest); 16 runReflectiveTests(InvocationComputerTest);
17 } 17 }
18 18
19 @ReflectiveTestCase() 19 @ReflectiveTestCase()
20 class InvocationComputerTest extends AbstractCompletionTest { 20 class InvocationComputerTest extends AbstractCompletionTest {
21 21
22 @override 22 @override
23 void setUp() { 23 void setUp() {
24 super.setUp(); 24 super.setUp();
25 computer = new InvocationComputer(); 25 computer = new InvocationComputer();
26 } 26 }
27 27
28 test_library_prefix() {
29 addSource('/testB.dart', 'lib B; class X { }');
30 addTestSource('import "/testB.dart" as b; main() {b.^}');
31 return computeFull().then((_) {
32 assertSuggestClass('X');
33 });
34 }
35
36 test_field() { 28 test_field() {
37 addTestSource('class A {var b; var _c;} main() {A a; a.^}'); 29 addTestSource('class A {var b; var _c;} main() {A a; a.^}');
38 return computeFull().then((_) { 30 return computeFull().then((_) {
39 assertSuggestField('b'); 31 assertSuggestField('b');
40 assertSuggestField('_c'); 32 assertSuggestField('_c');
41 }); 33 });
42 } 34 }
43 35
44 test_field_imported() { 36 test_field_imported() {
45 addSource('/testB.dart', 'lib B; class X {var y; var _z;}'); 37 addSource('/testB.dart', 'lib B; class X {var y; var _z;}');
46 addTestSource('import "/testB.dart"; main() {X x; x.^}'); 38 addTestSource('import "/testB.dart"; main() {X x; x.^}');
47 return computeFull().then((_) { 39 return computeFull().then((_) {
48 assertSuggestField('y'); 40 assertSuggestField('y');
49 assertNotSuggested('_z'); 41 assertNotSuggested('_z');
50 }); 42 });
51 } 43 }
52 44
45 test_field_superclass() {
46 addTestSource(
47 'class A {var b; var _c;} class B extends A {} main() {B b; b.^}');
48 return computeFull().then((_) {
49 assertSuggestField('b');
50 assertSuggestField('_c');
51 });
52 }
53
53 test_getter() { 54 test_getter() {
54 addTestSource('class A {A get b => new A();A get _c => new A();} main() {A a ; a.^}'); 55 addTestSource(
56 'class A {A get b => new A();A get _c => new A();} main() {A a; a.^}');
55 return computeFull().then((_) { 57 return computeFull().then((_) {
56 assertSuggestGetter('b'); 58 assertSuggestGetter('b');
57 assertSuggestGetter('_c'); 59 assertSuggestGetter('_c');
58 }); 60 });
59 } 61 }
60 62
61 test_getter_imported() { 63 test_getter_imported() {
62 addSource('/testB.dart', 'lib B; class X {X get y => new X(); X get _z => ne w X();}'); 64 addSource(
65 '/testB.dart',
66 'lib B; class X {X get y => new X(); X get _z => new X();}');
63 addTestSource('import "/testB.dart"; main() {X x; x.^}'); 67 addTestSource('import "/testB.dart"; main() {X x; x.^}');
64 return computeFull().then((_) { 68 return computeFull().then((_) {
65 assertSuggestGetter('y'); 69 assertSuggestGetter('y');
66 assertNotSuggested('_z'); 70 assertNotSuggested('_z');
67 }); 71 });
68 } 72 }
69 73
74 test_getter_interface() {
75 addTestSource(
76 '''class A {A get b => new A();A get _c => new A();}
77 class B implements A {A get b => new A();}
78 main() {B b; b.^}''');
79 return computeFull().then((_) {
80 assertSuggestGetter('b');
81 assertSuggestGetter('_c');
82 });
83 }
84
85 test_library_prefix() {
86 addSource('/testB.dart', 'lib B; class X { }');
87 addTestSource('import "/testB.dart" as b; main() {b.^}');
88 return computeFull().then((_) {
89 assertSuggestClass('X');
90 });
91 }
92
70 test_method() { 93 test_method() {
71 addTestSource('class A {b(X x) {} _c(X x) {}} main() {A a; a.^}'); 94 addTestSource('class A {b(X x) {} _c(X x) {}} main() {A a; a.^}');
72 return computeFull().then((_) { 95 return computeFull().then((_) {
73 assertSuggestMethod('b'); 96 assertSuggestMethod('b');
74 assertSuggestMethod('_c'); 97 assertSuggestMethod('_c');
75 }); 98 });
76 } 99 }
77 100
78 test_method_imported() { 101 test_method_imported() {
79 addSource('/testB.dart', 'lib B; class X {y(X x) {} _z(X x) {}}'); 102 addSource('/testB.dart', 'lib B; class X {y(X x) {} _z(X x) {}}');
80 addTestSource('import "/testB.dart"; main() {X x; x.^}'); 103 addTestSource('import "/testB.dart"; main() {X x; x.^}');
81 return computeFull().then((_) { 104 return computeFull().then((_) {
82 assertSuggestMethod('y'); 105 assertSuggestMethod('y');
83 assertNotSuggested('_z'); 106 assertNotSuggested('_z');
84 }); 107 });
85 } 108 }
86 109
110 test_method_imported_mixin() {
111 addSource('/testB.dart', 'lib B; class X {y(X x) {} _z(X x) {}}');
112 addTestSource('''import "/testB.dart";
113 class A extends Object with X {}
114 main() {A a; a.^}''');
115 return computeFull().then((_) {
116 assertSuggestMethod('y');
117 assertNotSuggested('_z');
118 });
119 }
120
87 test_setter() { 121 test_setter() {
88 addTestSource('class A {set b(X x) {} set _c(X x) {}} main() {A a; a.^}'); 122 addTestSource('class A {set b(X x) {} set _c(X x) {}} main() {A a; a.^}');
89 return computeFull().then((_) { 123 return computeFull().then((_) {
90 assertSuggestSetter('b'); 124 assertSuggestSetter('b');
91 assertSuggestSetter('_c'); 125 assertSuggestSetter('_c');
92 }); 126 });
93 } 127 }
94 128
95 test_setter_imported() { 129 test_setter_imported() {
96 addSource('/testB.dart', 'lib B; class X {set y(X x) {} set _z(X x) {}}'); 130 addSource('/testB.dart', 'lib B; class X {set y(X x) {} set _z(X x) {}}');
97 addTestSource('import "/testB.dart"; main() {X x; x.^}'); 131 addTestSource('import "/testB.dart"; main() {X x; x.^}');
98 return computeFull().then((_) { 132 return computeFull().then((_) {
99 assertSuggestSetter('y'); 133 assertSuggestSetter('y');
100 assertNotSuggested('_z'); 134 assertNotSuggested('_z');
101 }); 135 });
102 } 136 }
103 } 137 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698