mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 21:50:11 +00:00
Tests for FunctionReference in navigation.
Change-Id: I677197f6a27c3d20589fe612c4f5c84c5c5e2637 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212485 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
21cbe332fd
commit
d0935c2c85
|
@ -642,6 +642,92 @@ class AAA {
|
|||
assertNoRegion('fff);', 3);
|
||||
}
|
||||
|
||||
Future<void> test_functionReference_className_staticMethod() async {
|
||||
addTestFile('''
|
||||
class A {
|
||||
static void foo<T>() {}
|
||||
}
|
||||
void f() {
|
||||
A.foo<A>;
|
||||
}
|
||||
''');
|
||||
await prepareNavigation();
|
||||
assertHasRegionTarget('foo<A>', 'foo<T>');
|
||||
assertHasRegionTarget('A>', 'A {');
|
||||
}
|
||||
|
||||
Future<void> test_functionReference_function() async {
|
||||
addTestFile('''
|
||||
class A {}
|
||||
void foo<T>() {}
|
||||
void f() {
|
||||
foo<A>;
|
||||
}
|
||||
''');
|
||||
await prepareNavigation();
|
||||
assertHasRegionTarget('foo<A>', 'foo<T>');
|
||||
assertHasRegionTarget('A>', 'A {');
|
||||
}
|
||||
|
||||
Future<void> test_functionReference_importPrefix_function() async {
|
||||
newFile(join(testFolder, 'a.dart'), content: r'''
|
||||
void foo<T>() {}
|
||||
''');
|
||||
addTestFile('''
|
||||
import 'a.dart' as prefix;
|
||||
class A {}
|
||||
void f() {
|
||||
prefix.foo<A>;
|
||||
}
|
||||
''');
|
||||
await prepareNavigation();
|
||||
assertHasRegionTarget('prefix.', 'prefix;');
|
||||
assertHasRegion('foo<A>');
|
||||
assertHasRegionTarget('A>', 'A {');
|
||||
}
|
||||
|
||||
Future<void> test_functionReference_instance_method() async {
|
||||
addTestFile('''
|
||||
class A {
|
||||
void foo<T>() {}
|
||||
}
|
||||
void f(A a) {
|
||||
a.foo<A>;
|
||||
}
|
||||
''');
|
||||
await prepareNavigation();
|
||||
assertHasRegionTarget('foo<A>', 'foo<T>');
|
||||
assertHasRegionTarget('A>', 'A {');
|
||||
}
|
||||
|
||||
Future<void> test_functionReference_method() async {
|
||||
addTestFile('''
|
||||
class A {
|
||||
void foo<T>() {}
|
||||
void f() {
|
||||
foo<A>;
|
||||
}
|
||||
}
|
||||
''');
|
||||
await prepareNavigation();
|
||||
assertHasRegionTarget('foo<A>', 'foo<T>');
|
||||
assertHasRegionTarget('A>', 'A {');
|
||||
}
|
||||
|
||||
Future<void> test_functionReference_staticMethod() async {
|
||||
addTestFile('''
|
||||
class A {
|
||||
static void foo<T>() {}
|
||||
void f() {
|
||||
foo<A>;
|
||||
}
|
||||
}
|
||||
''');
|
||||
await prepareNavigation();
|
||||
assertHasRegionTarget('foo<A>', 'foo<T>');
|
||||
assertHasRegionTarget('A>', 'A {');
|
||||
}
|
||||
|
||||
Future<void> test_identifier_resolved() async {
|
||||
addTestFile('''
|
||||
class AAA {}
|
||||
|
|
Loading…
Reference in a new issue