Skip to content

Commit

Permalink
[analyzer] Add tests for null-aware elements and navigation to type
Browse files Browse the repository at this point in the history
Part of #56989

Change-Id: I162272e95f0b843b176d3a1708311991cea6017a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398882
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
  • Loading branch information
chloestefantsova authored and Commit Queue committed Dec 5, 2024
1 parent d2135e7 commit 0b5e5c6
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,46 @@ AAA aaa;
assertHasRegionTarget('AAA aaa;', 'AAA {}');
}

Future<void> test_afterAnalysis_inNullAwareElements_inList() async {
addTestFile('''
class AAA {}
final aaa = [?((AAA arg) => null)];
''');
await waitForTasksFinished();
await prepareNavigation();
assertHasRegionTarget('AAA arg', 'AAA {}');
}

Future<void> test_afterAnalysis_inNullAwareElements_inSet() async {
addTestFile('''
class AAA {}
final aaa = {?((AAA arg) => null)};
''');
await waitForTasksFinished();
await prepareNavigation();
assertHasRegionTarget('AAA arg', 'AAA {}');
}

Future<void> test_afterAnalysis_inNullAwareKey_inMap() async {
addTestFile('''
class AAA {}
final aaa = {?((AAA arg) => null): "value"};
''');
await waitForTasksFinished();
await prepareNavigation();
assertHasRegionTarget('AAA arg', 'AAA {}');
}

Future<void> test_afterAnalysis_inNullAwareValue_inMap() async {
addTestFile('''
class AAA {}
final aaa = {"key": ?((AAA arg) => null)};
''');
await waitForTasksFinished();
await prepareNavigation();
assertHasRegionTarget('AAA arg', 'AAA {}');
}

Future<void> test_annotation_generic_typeArguments_class() async {
addTestFile('''
class A<T> {
Expand Down

0 comments on commit 0b5e5c6

Please sign in to comment.