Skip to content

Commit

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

Change-Id: I733947154352f887896e48b96ead34d8e8159fb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381307
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
  • Loading branch information
pq authored and Commit Queue committed Aug 20, 2024
1 parent 6413386 commit 622c9b5
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions pkg/analysis_server/test/lsp/definition_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,33 @@ class A {
await testContents(contents);
}

Future<void> test_constructor_redirectingSuper_wildcards() async {
var contents = '''
class A {
final int x, y;
A(this.[!x!], [this.y = 0]);
}
class C extends A {
final int c;
C(this.c, super.^_);
}
''';

await testContents(contents);
}

Future<void> test_constructor_thisReference_wildcards() async {
var contents = '''
class A {
final int [!_!];
A(this.^_);
}
''';

await testContents(contents);
}

Future<void> test_constructorNamed() async {
var contents = '''
f() {
Expand Down Expand Up @@ -307,6 +334,17 @@ class [!A!] {
);
}

Future<void> test_field_underscore() async {
var contents = '''
class A {
int [!_!] = 1;
int f() => _^;
}
''';

await testContents(contents);
}

Future<void> test_fieldFormalParam() async {
var contents = '''
class A {
Expand Down Expand Up @@ -663,6 +701,17 @@ class A {}
expect(getTextForRange(macroContent, location.targetSelectionRange), 'foo');
}

Future<void> test_method_underscore() async {
var contents = '''
class A {
int [!_!]() => 1;
int f() => _^();
}
''';

await testContents(contents);
}

Future<void> test_nonDartFile() async {
newFile(pubspecFilePath, simplePubspecContent);
await initialize();
Expand Down Expand Up @@ -747,6 +796,15 @@ class B extends A {
await testContents(contents);
}

Future<void> test_topLevelVariable_underscore() async {
var contents = '''
int [!_!] = 0;
int f = ^_;
''';

await testContents(contents);
}

Future<void> test_type() async {
var contents = '''
f() {
Expand Down

0 comments on commit 622c9b5

Please sign in to comment.