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 <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/test/search/type_hierarchy_test.dart b/pkg/analysis_server/test/search/type_hierarchy_test.dart
index fe99e3f..85e4eb8 100644
--- a/pkg/analysis_server/test/search/type_hierarchy_test.dart
+++ b/pkg/analysis_server/test/search/type_hierarchy_test.dart
@@ -81,6 +81,71 @@
]);
}
+ Future<void> test_class_augmentation() async {
+ addTestFile('''
+import augment 'a.dart';
+
+class MyClass1 {}
+class C {}
+''');
+
+ newFile('$testPackageLibPath/a.dart', '''
+library augment 'test.dart';
+
+augment class C extends MyClass1 {}
+ ''');
+ var items = await _getTypeHierarchy('MyClass1 {}');
+ expect(_toJson(items), [
+ {
+ 'classElement': {
+ 'kind': 'CLASS',
+ 'name': 'MyClass1',
+ 'location': anything,
+ 'flags': 0
+ },
+ 'superclass': 1,
+ 'interfaces': [],
+ 'mixins': [],
+ 'subclasses': [2, 3]
+ },
+ {
+ 'classElement': {
+ 'kind': 'CLASS',
+ 'name': 'Object',
+ 'location': anything,
+ 'flags': 0
+ },
+ 'interfaces': [],
+ 'mixins': [],
+ 'subclasses': []
+ },
+ {
+ 'classElement': {
+ 'kind': 'CLASS',
+ 'name': 'C',
+ 'location': anything,
+ 'flags': 0
+ },
+ 'superclass': 0,
+ 'interfaces': [],
+ 'mixins': [],
+ 'subclasses': []
+ },
+ {
+ 'classElement': {
+ 'kind': 'CLASS',
+ 'name': 'C',
+ 'location': anything,
+ 'flags': 0
+ },
+ 'superclass': 0,
+ 'interfaces': [],
+ 'mixins': [],
+ 'subclasses': []
+ }
+ ]);
+ }
+
Future<void> test_class_displayName() async {
addTestFile('''
class A<T> {