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>
This commit is contained in:
Keerti Parthasarathy 2024-02-21 20:11:59 +00:00 committed by Commit Queue
parent 7c223d8312
commit 233de26ab4

View file

@ -81,6 +81,71 @@ class B extends A {
]);
}
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> {