Skip to content

Additional tests in the area of #2755 #2757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions test/end2end/model_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2153,6 +2153,41 @@ void main() {
return newLookupResult;
}

group('Linking for generalized typedef cases works', () {
Library generalizedTypedefs;
Typedef T0, T2, T5, T8;
Class C2;

setUpAll(() {
generalizedTypedefs = packageGraph.libraries
.firstWhere((l) => l.name == 'generalized_typedefs');
T0 = generalizedTypedefs.typedefs.firstWhere((a) => a.name == 'T0');
T2 = generalizedTypedefs.typedefs.firstWhere((a) => a.name == 'T2');
T5 = generalizedTypedefs.typedefs.firstWhere((a) => a.name == 'T5');
T8 = generalizedTypedefs.typedefs.firstWhere((a) => a.name == 'T8');
C2 = generalizedTypedefs.classes.firstWhere((c) => c.name == 'C2');
});

test('Verify basic ability to link anything', () {
expect(bothLookup(T0, 'C2'), equals(MatchingLinkResult(C2)));
expect(bothLookup(T2, 'C2'), equals(MatchingLinkResult(C2)));
expect(bothLookup(T5, 'C2'), equals(MatchingLinkResult(C2)));
expect(bothLookup(T8, 'C2'), equals(MatchingLinkResult(C2)));
});

test('Verify ability to link to type parameters', () {
var T2X = T2.typeParameters.firstWhere((t) => t.name == 'X');
expect(bothLookup(T2, 'X'), equals(MatchingLinkResult(T2X)));
var T5X = T5.typeParameters.firstWhere((t) => t.name == 'X');
expect(bothLookup(T5, 'X'), equals(MatchingLinkResult(T5X)));
});

test('Verify ability to link to parameters', () {
var T5name = T5.parameters.firstWhere((t) => t.name == 'name');
expect(bothLookup(T5, 'name'), equals(MatchingLinkResult(T5name)));
});
});

group('Linking for complex inheritance and reexport cases', () {
Library base, extending, local_scope, two_exports;
Class BaseWithMembers, ExtendingAgain;
Expand Down