[wildcards] legacy occurrences tests
See: https://github.com/dart-lang/sdk/issues/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>
diff --git a/pkg/analysis_server/test/analysis/notification_occurrences_test.dart b/pkg/analysis_server/test/analysis/notification_occurrences_test.dart
index f7874b3..2a58d2e 100644
--- a/pkg/analysis_server/test/analysis/notification_occurrences_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_occurrences_test.dart
@@ -117,6 +117,22 @@
);
}
+ 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,
@@ -427,6 +443,16 @@
);
}
+ 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,
@@ -646,6 +672,16 @@
);
}
+ 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,
@@ -687,6 +723,20 @@
);
}
+ 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,