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

Side by Side Diff: pkg/analysis_server/test/analysis/get_hover_test.dart

Issue 1632033002: Issue 25542. If an element does not have its own documentation, use the documentation from the over… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: New test cases and tweaks. Created 4 years, 11 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
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.domain.analysis.hover; 5 library test.domain.analysis.hover;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; 9 import 'package:analysis_server/plugin/protocol/protocol.dart';
10 import 'package:test_reflective_loader/test_reflective_loader.dart'; 10 import 'package:test_reflective_loader/test_reflective_loader.dart';
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 library my.library; 89 library my.library;
90 /// doc aaa 90 /// doc aaa
91 /// doc bbb 91 /// doc bbb
92 main() { 92 main() {
93 } 93 }
94 '''); 94 ''');
95 HoverInformation hover = await prepareHover('main() {'); 95 HoverInformation hover = await prepareHover('main() {');
96 expect(hover.dartdoc, '''doc aaa\ndoc bbb'''); 96 expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
97 } 97 }
98 98
99 test_dartdoc_inherited_methodByMethod_fromInterface() async {
100 addTestFile('''
101 class A {
102 /// my doc
103 m() {} // in A
104 }
105
106 class B implements A {
107 m() {} // in B
108 }
109 ''');
110 HoverInformation hover = await prepareHover('m() {} // in B');
111 expect(hover.dartdoc, '''my doc\n\nCopied from `A`.''');
112 }
113
114 test_dartdoc_inherited_methodByMethod_fromSuper_direct() async {
115 addTestFile('''
116 class A {
117 /// my doc
118 m() {} // in A
119 }
120
121 class B extends A {
122 m() {} // in B
123 }
124 ''');
125 HoverInformation hover = await prepareHover('m() {} // in B');
126 expect(hover.dartdoc, '''my doc\n\nCopied from `A`.''');
127 }
128
129 test_dartdoc_inherited_methodByMethod_fromSuper_indirect() async {
130 addTestFile('''
131 class A {
132 /// my doc
133 m() {}
134 }
135 class B extends A {
136 m() {}
137 }
138 class C extends B {
139 m() {} // in C
140 }''');
141 HoverInformation hover = await prepareHover('m() {} // in C');
142 expect(hover.dartdoc, '''my doc\n\nCopied from `A`.''');
143 }
144
145 test_dartdoc_inherited_methodByMethod_preferSuper() async {
146 addTestFile('''
147 class A {
148 /// my doc
149 m() {}
150 }
151 class B extends A {
152 }
153 class I {
154 // wrong doc
155 m() {}
156 }
157 class C extends B implements I {
158 m() {} // in C
159 }''');
160 HoverInformation hover = await prepareHover('m() {} // in C');
161 expect(hover.dartdoc, '''my doc\n\nCopied from `A`.''');
162 }
163
99 test_enum() async { 164 test_enum() async {
100 addTestFile(''' 165 addTestFile('''
101 enum MyEnum {AAA, BBB, CCC} 166 enum MyEnum {AAA, BBB, CCC}
102 '''); 167 ''');
103 HoverInformation hover = await prepareHover('MyEnum'); 168 HoverInformation hover = await prepareHover('MyEnum');
104 expect(hover.elementDescription, 'enum MyEnum'); 169 expect(hover.elementDescription, 'enum MyEnum');
105 expect(hover.staticType, isNull); 170 expect(hover.staticType, isNull);
106 expect(hover.propagatedType, isNull); 171 expect(hover.propagatedType, isNull);
107 } 172 }
108 173
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 addTestFile(''' 459 addTestFile('''
395 library my.library; 460 library my.library;
396 main() { 461 main() {
397 // nothing 462 // nothing
398 } 463 }
399 '''); 464 ''');
400 HoverInformation hover = await prepareHover('nothing'); 465 HoverInformation hover = await prepareHover('nothing');
401 expect(hover, isNull); 466 expect(hover, isNull);
402 } 467 }
403 } 468 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698