Skip to content

Commit

Permalink
[wildcards] legacy occurrences tests
Browse files Browse the repository at this point in the history
See: #55681

Change-Id: I5426ef22d56f6c2ab92a2028969cebd867a676ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382242
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
  • Loading branch information
pq authored and Commit Queue committed Aug 26, 2024
1 parent b61bde3 commit a4a146d
Showing 1 changed file with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,22 @@ void f() {
);
}

Future<void> test_class_field_underscore() async {
await assertOccurrences(
kind: ElementKind.FIELD,
'''
class C {
int /*[0*/_/*0]*/ = 0;
}
void f(int _) {
int _ = 1;
C()./*[1*/_/*1]*/;
}
''',
);
}

Future<void> test_enum() async {
await assertOccurrences(
kind: ElementKind.ENUM,
Expand Down Expand Up @@ -427,6 +443,16 @@ void g() {
);
}

Future<void> test_parameter_wildcard() async {
// Ensure no crash.
await assertOccurrences(
kind: ElementKind.PARAMETER,
'''
void f(int /*[0*/_/*0]*/) {}
''',
);
}

Future<void> test_pattern_assignment() async {
await assertOccurrences(
kind: ElementKind.PARAMETER,
Expand Down Expand Up @@ -646,6 +672,16 @@ String f(int char) {
);
}

Future<void> test_prefix_wildcard() async {
// Ensure no crash.
await assertOccurrences(
kind: ElementKind.PREFIX,
'''
import 'dart:io' as /*[0*/_/*0]*/;
''',
);
}

Future<void> test_recordType_typeName() async {
await assertOccurrences(
kind: ElementKind.CLASS,
Expand Down Expand Up @@ -687,6 +723,20 @@ void f() {
);
}

Future<void> test_topLevelVariable_underscore() async {
await assertOccurrences(
kind: ElementKind.TOP_LEVEL_VARIABLE,
'''
int /*[0*/_/*0]*/ = 0;
void f(int _) {
int _ = 1;
/*[1*/_/*1]*/;
}
''',
);
}

Future<void> test_type_class() async {
await assertOccurrences(
kind: ElementKind.CLASS,
Expand Down

0 comments on commit a4a146d

Please sign in to comment.