Skip to content

Commit 233de26

Browse files
keertipCommit Queue
authored andcommitted
Add test for augmentations to Type Hierarchy legacy protocol
Change-Id: Ib76f9ec23b0d2270aef5c0b85b7ac72d8cc528e3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353580 Commit-Queue: Keerti Parthasarathy <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 7c223d8 commit 233de26

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

pkg/analysis_server/test/search/type_hierarchy_test.dart

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,71 @@ class B extends A {
8181
]);
8282
}
8383

84+
Future<void> test_class_augmentation() async {
85+
addTestFile('''
86+
import augment 'a.dart';
87+
88+
class MyClass1 {}
89+
class C {}
90+
''');
91+
92+
newFile('$testPackageLibPath/a.dart', '''
93+
library augment 'test.dart';
94+
95+
augment class C extends MyClass1 {}
96+
''');
97+
var items = await _getTypeHierarchy('MyClass1 {}');
98+
expect(_toJson(items), [
99+
{
100+
'classElement': {
101+
'kind': 'CLASS',
102+
'name': 'MyClass1',
103+
'location': anything,
104+
'flags': 0
105+
},
106+
'superclass': 1,
107+
'interfaces': [],
108+
'mixins': [],
109+
'subclasses': [2, 3]
110+
},
111+
{
112+
'classElement': {
113+
'kind': 'CLASS',
114+
'name': 'Object',
115+
'location': anything,
116+
'flags': 0
117+
},
118+
'interfaces': [],
119+
'mixins': [],
120+
'subclasses': []
121+
},
122+
{
123+
'classElement': {
124+
'kind': 'CLASS',
125+
'name': 'C',
126+
'location': anything,
127+
'flags': 0
128+
},
129+
'superclass': 0,
130+
'interfaces': [],
131+
'mixins': [],
132+
'subclasses': []
133+
},
134+
{
135+
'classElement': {
136+
'kind': 'CLASS',
137+
'name': 'C',
138+
'location': anything,
139+
'flags': 0
140+
},
141+
'superclass': 0,
142+
'interfaces': [],
143+
'mixins': [],
144+
'subclasses': []
145+
}
146+
]);
147+
}
148+
84149
Future<void> test_class_displayName() async {
85150
addTestFile('''
86151
class A<T> {

0 commit comments

Comments
 (0)