Change completion tests to work in /home/test/.

Some completion tests (overrides) are valid when we make ChangeWorkspace
changes, because /completionTest.dart is not in /home/test. So, for
consistency I'm changing all tests to work with files in /home/test.

R=brianwilkerson@google.com

Change-Id: I050eedaf8da0aa47cdbc2d80195afa2ee23cdd01
Reviewed-on: https://dart-review.googlesource.com/c/87301
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2018-12-14 15:42:24 +00:00 committed by commit-bot@chromium.org
parent 2e3788898a
commit 9ec260fd8e
19 changed files with 1094 additions and 1107 deletions

View file

@ -647,9 +647,9 @@ main() {
}
test_local_override() {
newFile('/libA.dart', content: 'class A {m() {}}');
newFile('/project/bin/a.dart', content: 'class A {m() {}}');
addTestFile('''
import '../../libA.dart';
import 'a.dart';
class B extends A {
m() {}
x() {^}
@ -718,9 +718,9 @@ main() {
}
test_overrides() {
newFile('/libA.dart', content: 'class A {m() {}}');
newFile('/project/bin/a.dart', content: 'class A {m() {}}');
addTestFile('''
import '../../libA.dart';
import 'a.dart';
class B extends A {m() {^}}
''');
return getSuggestions().then((_) {
@ -732,10 +732,10 @@ class B extends A {m() {^}}
}
test_partFile() {
newFile('/project/bin/testA.dart', content: '''
newFile('/project/bin/a.dart', content: '''
library libA;
part "${convertAbsolutePathToUri(testFile)}";
import 'dart:html';
part 'test.dart';
class A { }
''');
addTestFile('''
@ -755,12 +755,12 @@ class B extends A {m() {^}}
}
test_partFile2() {
newFile('/testA.dart', content: '''
newFile('/project/bin/a.dart', content: '''
part of libA;
class A { }''');
addTestFile('''
library libA;
part "${convertAbsolutePathToUri("/testA.dart")}";
part "a.dart";
import 'dart:html';
main() {^}
''');

View file

@ -142,23 +142,22 @@ class ArgListContributorTest extends DartCompletionContributorTest {
}
test_Annotation_imported_constructor_named_param() async {
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library libA; class A { const A({int one, String two: 'defaultValue'}); }''');
addTestSource(
'import "${convertAbsolutePathToUri("/libA.dart")}"; @A(^) main() { }');
addTestSource('import "a.dart"; @A(^) main() { }');
await computeSuggestions();
assertSuggestArgumentsAndTypes(
namedArgumentsWithTypes: {'one': 'int', 'two': 'String'});
}
test_Annotation_importedConstructor_prefixed() async {
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
class A {
const A({int value});
}
''');
addTestSource('''
import "${convertAbsolutePathToUri("/libA.dart")}" as p;
import "a.dart" as p;
@p.A(^)
main() {}
''');
@ -463,28 +462,26 @@ foo({String children}) {}
test_ArgumentList_imported_constructor_named_param() async {
// ArgumentList InstanceCreationExpression ExpressionStatement
addSource('/libA.dart', 'library libA; class A{A({int one}); }');
addTestSource(
'import "${convertAbsolutePathToUri("/libA.dart")}"; main() { new A(^);}');
addSource('/home/test/lib/a.dart', 'library libA; class A{A({int one}); }');
addTestSource('import "a.dart"; main() { new A(^);}');
await computeSuggestions();
assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
}
test_ArgumentList_imported_constructor_named_param2() async {
// ArgumentList InstanceCreationExpression ExpressionStatement
addSource('/libA.dart', 'library libA; class A{A.foo({int one}); }');
addTestSource(
'import "${convertAbsolutePathToUri("/libA.dart")}"; main() { new A.foo(^);}');
addSource(
'/home/test/lib/a.dart', 'library libA; class A{A.foo({int one}); }');
addTestSource('import "a.dart"; main() { new A.foo(^);}');
await computeSuggestions();
assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
}
test_ArgumentList_imported_constructor_named_typed_param() async {
// ArgumentList InstanceCreationExpression VariableDeclaration
addSource(
'/libA.dart', 'library libA; class A { A({int i, String s, d}) {} }}');
addTestSource(
'import "${convertAbsolutePathToUri("/libA.dart")}"; main() { var a = new A(^);}');
addSource('/home/test/lib/a.dart',
'library libA; class A { A({int i, String s, d}) {} }}');
addTestSource('import "a.dart"; main() { var a = new A(^);}');
await computeSuggestions();
assertSuggestArgumentsAndTypes(
namedArgumentsWithTypes: {'i': 'int', 's': 'String', 'd': 'dynamic'});
@ -492,30 +489,27 @@ foo({String children}) {}
test_ArgumentList_imported_factory_named_param() async {
// ArgumentList InstanceCreationExpression ExpressionStatement
addSource(
'/libA.dart', 'library libA; class A{factory A({int one}) => null;}');
addTestSource(
'import "${convertAbsolutePathToUri("/libA.dart")}"; main() { new A(^);}');
addSource('/home/test/lib/a.dart',
'library libA; class A{factory A({int one}) => null;}');
addTestSource('import "a.dart"; main() { new A(^);}');
await computeSuggestions();
assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
}
test_ArgumentList_imported_factory_named_param2() async {
// ArgumentList InstanceCreationExpression ExpressionStatement
addSource('/libA.dart',
addSource('/home/test/lib/a.dart',
'library libA; abstract class A{factory A.foo({int one});}');
addTestSource(
'import "${convertAbsolutePathToUri("/libA.dart")}"; main() { new A.foo(^);}');
addTestSource('import "a.dart"; main() { new A.foo(^);}');
await computeSuggestions();
assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
}
test_ArgumentList_imported_factory_named_typed_param() async {
// ArgumentList InstanceCreationExpression VariableDeclaration
addSource('/libA.dart',
addSource('/home/test/lib/a.dart',
'library libA; class A {factory A({int i, String s, d}) {} }}');
addTestSource(
'import "${convertAbsolutePathToUri("/libA.dart")}"; main() { var a = new A(^);}');
addTestSource('import "a.dart"; main() { var a = new A(^);}');
await computeSuggestions();
assertSuggestArgumentsAndTypes(
namedArgumentsWithTypes: {'i': 'int', 's': 'String', 'd': 'dynamic'});
@ -523,13 +517,13 @@ foo({String children}) {}
test_ArgumentList_imported_function_0() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
expect() { }
void baz() { }''');
addTestSource('''
import '${convertAbsolutePathToUri('/libA.dart')}'
import 'a.dart'
class B { }
String bar() => true;
void main() {expect(a^)}''');
@ -539,13 +533,13 @@ foo({String children}) {}
test_ArgumentList_imported_function_1() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(String arg) { }
void baz() { }''');
addTestSource('''
import '${convertAbsolutePathToUri('/libA.dart')}'
import 'a.dart'
class B { }
String bar() => true;
void main() {expect(^)}''');
@ -555,13 +549,13 @@ foo({String children}) {}
test_ArgumentList_imported_function_2() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(String arg1, int arg2) { }
void baz() { }''');
addTestSource('''
import '${convertAbsolutePathToUri('/libA.dart')}'
import 'a.dart'
class B { }
String bar() => true;
void main() {expect(^)}''');
@ -571,13 +565,13 @@ foo({String children}) {}
test_ArgumentList_imported_function_3() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(String arg1, int arg2, {bool arg3}) { }
void baz() { }''');
addTestSource('''
import '${convertAbsolutePathToUri('/libA.dart')}'
import 'a.dart'
class B { }
String bar() => true;
void main() {expect(^)}''');
@ -587,13 +581,13 @@ foo({String children}) {}
test_ArgumentList_imported_function_3a() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(String arg1, int arg2, {bool arg3}) { }
void baz() { }''');
addTestSource('''
import '${convertAbsolutePathToUri('/libA.dart')}'
import 'a.dart'
class B { }
String bar() => true;
void main() {expect('hello', ^)}''');
@ -603,13 +597,13 @@ foo({String children}) {}
test_ArgumentList_imported_function_3b() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(String arg1, int arg2, {bool arg3}) { }
void baz() { }''');
addTestSource('''
import '${convertAbsolutePathToUri('/libA.dart')}'
import 'a.dart'
class B { }
String bar() => true;
void main() {expect('hello', ^x)}''');
@ -619,13 +613,13 @@ foo({String children}) {}
test_ArgumentList_imported_function_3c() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(String arg1, int arg2, {bool arg3}) { }
void baz() { }''');
addTestSource('''
import '${convertAbsolutePathToUri('/libA.dart')}'
import 'a.dart'
class B { }
String bar() => true;
void main() {expect('hello', x^)}''');
@ -635,13 +629,13 @@ foo({String children}) {}
test_ArgumentList_imported_function_3d() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(String arg1, int arg2, {bool arg3}) { }
void baz() { }''');
addTestSource('''
import '${convertAbsolutePathToUri('/libA.dart')}'
import 'a.dart'
class B { }
String bar() => true;
void main() {expect('hello', x ^)}''');
@ -1025,12 +1019,12 @@ main() { f("16", radix: ^);}''');
test_ArgumentList_local_method_0() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import '${convertAbsolutePathToUri('/libA.dart')}'
import 'a.dart'
class B {
expect() { }
void foo() {expect(^)}}
@ -1041,12 +1035,12 @@ main() { f("16", radix: ^);}''');
test_ArgumentList_local_method_2() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import '${convertAbsolutePathToUri('/libA.dart')}'
import 'a.dart'
class B {
expect(arg, int blat) { }
void foo() {expect(^)}}

View file

@ -36,22 +36,22 @@ class CombinatorContributorTest extends DartCompletionContributorTest {
test_Combinator_hide() async {
// SimpleIdentifier HideCombinator ImportDirective
addSource('/testAB.dart', '''
addSource('/home/test/lib/ab.dart', '''
library libAB;
part "${convertAbsolutePathToUri('/partAB.dart')}";
part "ab_part.dart";
class A { }
class B { }''');
addSource('/partAB.dart', '''
addSource('/home/test/lib/ab_part.dart', '''
part of libAB;
var T1;
PB F1() => new PB();
class PB { }''');
addSource('/testCD.dart', '''
addSource('/home/test/lib/cd.dart', '''
class C { }
class D { }''');
addTestSource('''
import "${convertAbsolutePathToUri("/testAB.dart")}" hide ^;
import "${convertAbsolutePathToUri("/testCD.dart")}";
import "ab.dart" hide ^;
import "cd.dart";
class X {}''');
await computeSuggestions();
@ -76,25 +76,25 @@ class CombinatorContributorTest extends DartCompletionContributorTest {
test_Combinator_show() async {
// SimpleIdentifier HideCombinator ImportDirective
addSource('/testAB.dart', '''
addSource('/home/test/lib/ab.dart', '''
library libAB;
part "${convertAbsolutePathToUri('/partAB.dart')}";
part "ab_part.dart";
class A { }
class B { }
class _AB''');
addSource('/partAB.dart', '''
addSource('/home/test/lib/ab_part.dart', '''
part of libAB;
var T1;
PB F1() => new PB();
typedef PB2 F2(int blat);
class Clz = Object with Object;
class PB { }''');
addSource('/testCD.dart', '''
addSource('/home/test/lib/cd.dart', '''
class C { }
class D { }''');
addTestSource('''
import "${convertAbsolutePathToUri("/testAB.dart")}" show ^;
import "${convertAbsolutePathToUri("/testCD.dart")}";
import "ab.dart" show ^;
import "cd.dart";
class X {}''');
await computeSuggestions();
@ -124,11 +124,11 @@ class CombinatorContributorTest extends DartCompletionContributorTest {
}
test_Combinator_show_export_withShow() async {
addSource('/a.dart', r'''
addSource('/home/test/lib/a.dart', r'''
class A {}
class B {}
''');
addSource('/b.dart', r'''
addSource('/home/test/lib/b.dart', r'''
export 'a.dart' show A;
''');
addTestSource(r'''
@ -149,16 +149,16 @@ import 'b.dart' show ^;
}
test_Combinator_show_recursive() async {
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
class A {}
''');
addSource('/testB.dart', '''
export 'testA.dart';
export 'testB.dart';
addSource('/home/test/lib/b.dart', '''
export 'a.dart';
export 'b.dart';
class B {}
''');
addTestSource('''
import "${convertAbsolutePathToUri("/testB.dart")}" show ^;
import "b.dart" show ^;
''');
await computeSuggestions();
assertSuggestClass('A',

View file

@ -543,7 +543,7 @@ abstract class DartCompletionContributorTest extends AbstractContextTest {
@override
void setUp() {
super.setUp();
testFile = convertPath('/completionTest.dart');
testFile = convertPath('/home/test/lib/test.dart');
contributor = createContributor();
}
}

View file

@ -30,7 +30,7 @@ class CompletionManagerTest extends DartCompletionContributorTest {
}
test_resolveDirectives() async {
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library libA;
/// My class.
/// Short description.
@ -38,10 +38,10 @@ library libA;
/// Longer description.
class A {}
''');
addSource('/libB.dart', '''
addSource('/home/test/lib/b.dart', '''
library libB;
import "/libA.dart" as foo;
part '${convertAbsolutePathToUri(testFile)}';
import "a.dart" as foo;
part 'test.dart';
''');
addTestSource('part of libB; main() {^}');
@ -83,6 +83,6 @@ part '${convertAbsolutePathToUri(testFile)}';
// Assert that the new imports each have an export namespace
assertImportedLib('dart:core');
assertImportedLib('libA.dart');
assertImportedLib('a.dart');
}
}

View file

@ -31,7 +31,7 @@ class InheritedReferenceContributorTest extends DartCompletionContributorTest {
/// Sanity check. Permutations tested in local_ref_contributor.
test_ArgDefaults_inherited_method_with_required_named() async {
addMetaPackage();
resolveSource('/testB.dart', '''
resolveSource('/home/test/lib/b.dart', '''
import 'package:meta/meta.dart';
lib libB;
@ -39,7 +39,7 @@ class A {
bool foo(int bar, {bool boo, @required int baz}) => false;
}''');
addTestSource('''
import "testB.dart";
import "b.dart";
class B extends A {
b() => f^
}
@ -52,13 +52,13 @@ class B extends A {
test_AwaitExpression_inherited() async {
// SimpleIdentifier AwaitExpression ExpressionStatement
resolveSource('/testB.dart', '''
resolveSource('/home/test/lib/b.dart', '''
lib libB;
class A {
Future y() async {return 0;}
}''');
addTestSource('''
import "testB.dart";
import "b.dart";
class B extends A {
Future a() async {return 0;}
foo() async {await ^}
@ -78,14 +78,14 @@ class B extends A {
test_Block_inherited_imported() async {
// Block BlockFunctionBody MethodDeclaration ClassDeclaration
resolveSource('/testB.dart', '''
resolveSource('/home/test/lib/b.dart', '''
lib B;
class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; }
class E extends F { var e1; e2() { } }
class I { int i1; i2() { } }
class M { var m1; int m2() { } }''');
addTestSource('''
import "testB.dart";
import "b.dart";
class A extends E implements I with M {a() {^}}''');
await computeSuggestions();
expect(replacementOffset, completionOffset);
@ -164,7 +164,7 @@ $spaces_4});''',
}
test_inherited() async {
resolveSource('/testB.dart', '''
resolveSource('/home/test/lib/b.dart', '''
lib libB;
class A2 {
int x;
@ -173,7 +173,7 @@ class A2 {
int y2() {return 0;}
}''');
addTestSource('''
import "testB.dart";
import "b.dart";
class A1 {
int x;
int y() {return 0;}
@ -240,13 +240,13 @@ mixin M on C {
}
test_method_parameters_mixed_required_and_named() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
void m(x, {int y}) {}
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -283,13 +283,13 @@ class B extends A {
}
test_method_parameters_mixed_required_and_positional() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
void m(x, [int y]) {}
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -326,13 +326,13 @@ class B extends A {
}
test_method_parameters_named() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
void m({x, int y}) {}
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -369,13 +369,13 @@ class B extends A {
}
test_method_parameters_none() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
void m() {}
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -406,13 +406,13 @@ class B extends A {
}
test_method_parameters_positional() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
void m([x, int y]) {}
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -449,13 +449,13 @@ class B extends A {
}
test_method_parameters_required() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
void m(x, int y) {}
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -472,7 +472,7 @@ class B extends A {
}
test_mixin_ordering() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class B {}
class M1 {
void m() {}
@ -482,7 +482,7 @@ class M2 {
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class C extends B with M1, M2 {
void f() {
^
@ -494,13 +494,13 @@ class C extends B with M1, M2 {
}
test_no_parameters_field() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
int x;
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -511,13 +511,13 @@ class B extends A {
}
test_no_parameters_getter() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
int get x => null;
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -528,13 +528,13 @@ class B extends A {
}
test_no_parameters_setter() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
set x(int value) {};
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -545,7 +545,7 @@ class B extends A {
}
test_outside_class() async {
resolveSource('/testB.dart', '''
resolveSource('/home/test/lib/b.dart', '''
lib libB;
class A2 {
int x;
@ -554,7 +554,7 @@ class A2 {
int y2() {return 0;}
}''');
addTestSource('''
import "testB.dart";
import "b.dart";
class A1 {
int x;
int y() {return 0;}
@ -586,7 +586,7 @@ foo() {^}
}
test_static_field() async {
resolveSource('/testB.dart', '''
resolveSource('/home/test/lib/b.dart', '''
lib libB;
class A2 {
int x;
@ -595,7 +595,7 @@ class A2 {
int y2() {return 0;}
}''');
addTestSource('''
import "testB.dart";
import "b.dart";
class A1 {
int x;
int y() {return 0;}
@ -627,7 +627,7 @@ class B extends A1 with A2 {
}
test_static_method() async {
resolveSource('/testB.dart', '''
resolveSource('/home/test/lib/b.dart', '''
lib libB;
class A2 {
int x;
@ -636,7 +636,7 @@ class A2 {
int y2() {return 0;}
}''');
addTestSource('''
import "testB.dart";
import "b.dart";
class A1 {
int x;
int y() {return 0;}

View file

@ -87,11 +87,10 @@ class LibraryMemberContributorTest extends DartCompletionContributorTest {
test_libraryPrefix_deferred_inPart() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
var libFile = '${testFile.substring(0, testFile.length - 5)}A.dart';
addSource(libFile, '''
addSource('/home/test/lib/a.dart', '''
library testA;
import "dart:async" deferred as bar;
part "${convertAbsolutePathToUri(testFile)}";''');
part "test.dart";''');
addTestSource('part of testA; foo() {bar.^}');
// Assume that libraries containing has been computed for part files
await computeSuggestions();
@ -101,14 +100,13 @@ class LibraryMemberContributorTest extends DartCompletionContributorTest {
}
test_libraryPrefix_with_exports() async {
addSource('/libA.dart', 'library libA; class A { }');
addSource('/libB.dart', '''
addSource('/home/test/lib/a.dart', 'library libA; class A { }');
addSource('/home/test/lib/b.dart', '''
library libB;
export "${convertAbsolutePathToUri("/libA.dart")}";
export "a.dart";
class B { }
@deprecated class B1 { }''');
addTestSource(
'import "${convertAbsolutePathToUri("/libB.dart")}" as foo; main() {foo.^} class C { }');
addTestSource('import "b.dart" as foo; main() {foo.^} class C { }');
await computeSuggestions();
assertSuggestClass('B');
assertSuggestClass('B1', relevance: DART_RELEVANCE_LOW, isDeprecated: true);
@ -118,13 +116,13 @@ class LibraryMemberContributorTest extends DartCompletionContributorTest {
test_PrefixedIdentifier_library() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
class X { }
class Y { }''');
addTestSource('''
import "${convertAbsolutePathToUri("/testB.dart")}" as b;
import "b.dart" as b;
var T2;
class A { }
main() {b.^}''');
@ -142,11 +140,11 @@ class LibraryMemberContributorTest extends DartCompletionContributorTest {
}
test_PrefixedIdentifier_library_export_withShow() async {
addSource('/a.dart', r'''
addSource('/home/test/lib/a.dart', r'''
class A {}
class B {}
''');
addSource('/b.dart', r'''
addSource('/home/test/lib/b.dart', r'''
export 'a.dart' show A;
''');
addTestSource(r'''
@ -161,7 +159,7 @@ main() {
}
test_PrefixedIdentifier_library_import_withShow() async {
addSource('/a.dart', r'''
addSource('/home/test/lib/a.dart', r'''
class A {}
class B {}
''');
@ -178,16 +176,15 @@ main() {
test_PrefixedIdentifier_library_inPart() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
var libFile = '${testFile.substring(0, testFile.length - 5)}A.dart';
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
class X { }
class Y { }''');
addSource(libFile, '''
addSource('/home/test/lib/a.dart', '''
library testA;
import "${convertAbsolutePathToUri("/testB.dart")}" as b;
part "${convertAbsolutePathToUri(testFile)}";
import "b.dart" as b;
part "test.dart";
var T2;
class A { }''');
addTestSource('''
@ -209,13 +206,13 @@ main() {
test_PrefixedIdentifier_library_typesOnly() async {
// SimpleIdentifier PrefixedIdentifier TypeName
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
class X { }
class Y { }''');
addTestSource('''
import "${convertAbsolutePathToUri("/testB.dart")}" as b;
import "b.dart" as b;
var T2;
class A { }
foo(b.^ f) {}''');
@ -234,13 +231,13 @@ main() {
test_PrefixedIdentifier_library_typesOnly2() async {
// SimpleIdentifier PrefixedIdentifier TypeName
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
class X { }
class Y { }''');
addTestSource('''
import "${convertAbsolutePathToUri("/testB.dart")}" as b;
import "b.dart" as b;
var T2;
class A { }
foo(b.^) {}''');
@ -259,13 +256,13 @@ main() {
test_PrefixedIdentifier_parameter() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
class _W {M y; var _z;}
class X extends _W {}
class M{}''');
addTestSource('''
import "${convertAbsolutePathToUri("/testB.dart")}";
import "b.dart";
foo(X x) {x.^}''');
await computeSuggestions();
assertNoSuggestions();
@ -273,11 +270,11 @@ main() {
test_PrefixedIdentifier_prefix() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
class A {static int bar = 10;}
_B() {}''');
addTestSource('''
import "${convertAbsolutePathToUri("/testA.dart")}";
import "a.dart";
class X {foo(){A^.bar}}''');
await computeSuggestions();
assertNoSuggestions();

View file

@ -42,29 +42,29 @@ class LibraryPrefixContributorTest extends DartCompletionContributorTest {
test_Block() async {
// Block BlockFunctionBody MethodDeclaration
addSource('/testAB.dart', '''
addSource('/home/test/lib/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('/testCD.dart', '''
addSource('/home/test/lib/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('/testEEF.dart', '''
addSource('/home/test/lib/eef.dart', '''
class EE { }
class F { }''');
addSource('/testG.dart', 'class G { }');
addSource('/testH.dart', '''
addSource('/home/test/lib/g.dart', 'class G { }');
addSource('/home/test/lib/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
addTestSource('''
import "testAB.dart";
import "testCD.dart" hide D;
import "testEEF.dart" show EE;
import "testG.dart" as g;
import "ab.dart";
import "cd.dart" hide D;
import "eef.dart" show EE;
import "g.dart" as g;
int T5;
var _T6;
String get T7 => 'hello';
@ -183,10 +183,10 @@ class Z { }''');
test_ClassDeclaration_body() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import "b.dart" as x;
@deprecated class A {^}
class _B {}
A T;''');
@ -198,10 +198,10 @@ A T;''');
test_ClassDeclaration_body_final() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import "b.dart" as x;
class A {final ^}
class _B {}
A T;''');
@ -213,10 +213,10 @@ A T;''');
test_ClassDeclaration_body_final_field() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import "b.dart" as x;
class A {final ^ A(){}}
class _B {}
A T;''');
@ -228,10 +228,10 @@ A T;''');
test_ClassDeclaration_body_final_field2() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as Soo;
import "b.dart" as Soo;
class A {final S^ A();}
class _B {}
A Sew;''');
@ -243,10 +243,10 @@ A Sew;''');
test_ClassDeclaration_body_final_final() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import "b.dart" as x;
class A {final ^ final foo;}
class _B {}
A T;''');
@ -258,10 +258,10 @@ A T;''');
test_ClassDeclaration_body_final_var() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import "b.dart" as x;
class A {final ^ var foo;}
class _B {}
A T;''');
@ -272,12 +272,12 @@ A T;''');
}
test_InstanceCreationExpression() async {
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
class A {foo(){var f; {var x;}}}
class B {B(this.x, [String boo]) { } int x;}
class C {C.bar({boo: 'hoo', int z: 0}) { } }''');
addTestSource('''
import "testA.dart" as t;
import "a.dart" as t;
import "dart:math" as math;
main() {new ^ String x = "hello";}''');
await computeSuggestions();
@ -291,15 +291,15 @@ main() {new ^ String x = "hello";}''');
}
test_InstanceCreationExpression_inPart() async {
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
class A {foo(){var f; {var x;}}}
class B {B(this.x, [String boo]) { } int x;}
class C {C.bar({boo: 'hoo', int z: 0}) { } }''');
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
library testB;
import "${convertAbsolutePathToUri("/testA.dart")}" as t;
import "a.dart" as t;
import "dart:math" as math;
part "${convertAbsolutePathToUri(testFile)}"
part "test.dart";
main() {new ^ String x = "hello";}''');
addTestSource('''
part of testB;
@ -309,13 +309,13 @@ main() {new ^ String x = "hello";}''');
}
test_InstanceCreationExpression_inPart_detached() async {
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
class A {foo(){var f; {var x;}}}
class B {B(this.x, [String boo]) { } int x;}
class C {C.bar({boo: 'hoo', int z: 0}) { } }''');
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
library testB;
import "testA.dart" as t;
import "a.dart" as t;
import "dart:math" as math;
//part "$testFile"
main() {new ^ String x = "hello";}''');

View file

@ -74,12 +74,12 @@ class A {
test_ArgumentList() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B { }
String bar() => true;
void main() {expect(^)}''');
@ -104,13 +104,13 @@ void main() {expect(^)}''');
test_ArgumentList_imported_function() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(arg) { }
void baz() { }''');
addTestSource('''
import 'libA.dart'
import 'a.dart';
class B { }
String bar() => true;
void main() {expect(^)}''');
@ -135,14 +135,14 @@ void main() {expect(^)}''');
test_ArgumentList_InstanceCreationExpression_functionalArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'dart:async';
import 'libA.dart';
import 'a.dart';
class B { }
String bar() => true;
void main() {new A(^)}''');
@ -168,7 +168,7 @@ void main() {new A(^)}''');
test_ArgumentList_InstanceCreationExpression_typedefArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
typedef Funct();
class A { A(Funct f) { } }
@ -176,7 +176,7 @@ bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'dart:async';
import 'libA.dart';
import 'a.dart';
class B { }
String bar() => true;
void main() {new A(^)}''');
@ -202,12 +202,12 @@ void main() {new A(^)}''');
test_ArgumentList_local_function() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'libA.dart'
import 'a.dart';
expect(arg) { }
class B { }
String bar() => true;
@ -233,12 +233,12 @@ void main() {expect(^)}''');
test_ArgumentList_local_method() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'libA.dart'
import 'a.dart';
class B {
expect(arg) { }
void foo() {expect(^)}}
@ -264,14 +264,14 @@ String bar() => true;''');
test_ArgumentList_MethodInvocation_functionalArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'dart:async';
import 'libA.dart';
import 'a.dart';
class B { }
String bar(f()) => true;
void main() {bar(^);}''');
@ -297,14 +297,14 @@ void main() {bar(^);}''');
test_ArgumentList_MethodInvocation_methodArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'dart:async';
import 'libA.dart';
import 'a.dart';
class B { String bar(f()) => true; }
void main() {new B().bar(^);}''');
await computeSuggestions();
@ -329,11 +329,11 @@ void main() {new B().bar(^);}''');
test_ArgumentList_namedParam() async {
// SimpleIdentifier NamedExpression ArgumentList MethodInvocation
// ExpressionStatement
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }''');
addTestSource('''
import 'libA.dart'
import 'a.dart';
String bar() => true;
void main() {expect(foo: ^)}''');
await computeSuggestions();
@ -1037,14 +1037,14 @@ class Z { }''');
test_Block_inherited_imported() async {
// Block BlockFunctionBody MethodDeclaration ClassDeclaration
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; }
class E extends F { var e1; e2() { } }
class I { int i1; i2() { } }
class M { var m1; int m2() { } }''');
addTestSource('''
import "testB.dart";
import "b.dart";
class A extends E implements I with M {a() {^}}''');
await computeSuggestions();
@ -1156,10 +1156,10 @@ class Z { }''');
test_CascadeExpression_selector1() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart";
import "b.dart";
class A {var b; X _c;}
class X{}
// looks like a cascade to the parser
@ -1181,10 +1181,10 @@ main() {A a; a.^.z}''');
test_CascadeExpression_selector2() async {
// SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart";
import "b.dart";
class A {var b; X _c;}
class X{}
main() {A a; a..^z}''');
@ -1204,10 +1204,10 @@ main() {A a; a..^z}''');
test_CascadeExpression_selector2_withTrailingReturn() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart";
import "b.dart";
class A {var b; X _c;}
class X{}
main() {A a; a..^ return}''');
@ -1304,10 +1304,10 @@ main() {A a; a^..b}''');
test_ClassDeclaration_body() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import "b.dart" as x;
@deprecated class A {^}
class _B {}
A T;''');
@ -1325,10 +1325,10 @@ A T;''');
test_ClassDeclaration_body_final() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import "b.dart" as x;
class A {final ^}
class _B {}
A T;''');
@ -1346,10 +1346,10 @@ A T;''');
test_ClassDeclaration_body_final_field() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import "b.dart" as x;
class A {final ^ A(){}}
class _B {}
A T;''');
@ -1367,10 +1367,10 @@ A T;''');
test_ClassDeclaration_body_final_field2() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as Soo;
import "b.dart" as Soo;
class A {final S^ A();}
class _B {}
A Sew;''');
@ -1388,10 +1388,10 @@ A Sew;''');
test_ClassDeclaration_body_final_final() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import "b.dart" as x;
class A {final ^ final foo;}
class _B {}
A T;''');
@ -1409,10 +1409,10 @@ A T;''');
test_ClassDeclaration_body_final_var() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import "b.dart" as x;
class A {final ^ var foo;}
class _B {}
A T;''');
@ -1480,12 +1480,12 @@ class X {}''');
test_ConditionalExpression_elseExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -1500,12 +1500,12 @@ class C {foo(){var f; {var x;} return a ? T1 : T^}}''');
test_ConditionalExpression_elseExpression_empty() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -1530,12 +1530,12 @@ class C {foo(){var f; {var x;} return a ? T1 : ^}}''');
test_ConditionalExpression_partial_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -1550,12 +1550,12 @@ class C {foo(){var f; {var x;} return a ? T^}}''');
test_ConditionalExpression_partial_thenExpression_empty() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -1580,12 +1580,12 @@ class C {foo(){var f; {var x;} return a ? ^}}''');
test_ConditionalExpression_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -1636,13 +1636,13 @@ class C {foo(){var f; {var x;} return a ? T^ : c}}''');
test_ConstructorName_importedClass() async {
// SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
// InstanceCreationExpression
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import "b.dart";
var m;
main() {new X.^}''');
await computeSuggestions();
@ -1661,13 +1661,13 @@ main() {new X.^}''');
test_ConstructorName_importedFactory() async {
// SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
// InstanceCreationExpression
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {factory X.c(); factory X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import "b.dart";
var m;
main() {new X.^}''');
await computeSuggestions();
@ -1783,12 +1783,12 @@ class A {a(blat: ^) { }}''');
test_ExpressionStatement_identifier() async {
// SimpleIdentifier ExpressionStatement Block
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
_B F1() { }
class A {int x;}
class _B { }''');
addTestSource('''
import "testA.dart";
import "a.dart";
typedef int F2(int blat);
class Clz = Object with Object;
class C {foo(){^} void bar() {}}''');
@ -1813,11 +1813,11 @@ class C {foo(){^} void bar() {}}''');
test_ExpressionStatement_name() async {
// ExpressionStatement Block BlockFunctionBody MethodDeclaration
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
B T1;
class B{}''');
addTestSource('''
import "testA.dart";
import "a.dart";
class C {a() {C ^}}''');
await computeSuggestions();
@ -1827,9 +1827,9 @@ class C {foo(){^} void bar() {}}''');
test_FieldDeclaration_name_typed() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
addSource('/testA.dart', 'class A { }');
addSource('/home/test/lib/a.dart', 'class A { }');
addTestSource('''
import "testA.dart";
import "a.dart";
class C {A ^}''');
await computeSuggestions();
@ -1839,9 +1839,9 @@ class C {foo(){^} void bar() {}}''');
test_FieldDeclaration_name_var() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
addSource('/testA.dart', 'class A { }');
addSource('/home/test/lib/a.dart', 'class A { }');
addTestSource('''
import "testA.dart";
import "a.dart";
class C {var ^}''');
await computeSuggestions();
@ -2071,13 +2071,13 @@ class B extends A {
test_FunctionDeclaration_returnType_afterComment() async {
// ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2101,13 +2101,13 @@ class C2 { }
test_FunctionDeclaration_returnType_afterComment2() async {
// FunctionDeclaration ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2131,13 +2131,13 @@ class C2 { }
test_FunctionDeclaration_returnType_afterComment3() async {
// FunctionDeclaration ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2298,12 +2298,12 @@ main(aaa, bbb) {}''');
test_IndexExpression() async {
// ExpressionStatement Block
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -2328,12 +2328,12 @@ class C {foo(){var f; {var x;} f[^]}}''');
test_IndexExpression2() async {
// SimpleIdentifier IndexExpression ExpressionStatement Block
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -2462,12 +2462,12 @@ main() {
test_InstanceCreationExpression_imported() async {
// SimpleIdentifier TypeName ConstructorName InstanceCreationExpression
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {A(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
import "dart:async";
int T2;
F2() { }
@ -2581,13 +2581,13 @@ main() {
test_InterpolationExpression() async {
// SimpleIdentifier InterpolationExpression StringInterpolation
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2615,13 +2615,13 @@ main() {String name; print("hello \$^");}''');
test_InterpolationExpression_block() async {
// SimpleIdentifier InterpolationExpression StringInterpolation
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2691,12 +2691,12 @@ main() {String name; print("hello \${^}");}''');
test_IsExpression() async {
// SimpleIdentifier TypeName IsExpression IfStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
foo() { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import "b.dart";
class Y {Y.c(); Y._d(); z() {}}
main() {var x; if (x is ^) { }}''');
await computeSuggestions();
@ -2764,14 +2764,14 @@ main(){var a; if (a is Obj^)}''');
}
test_keyword() async {
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int newT1;
int T1;
nowIsIt() { }
class X {factory X.c(); factory X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import "b.dart";
String newer() {}
var m;
main() {new^ X.c();}''');
@ -2826,13 +2826,13 @@ main() {new^ X.c();}''');
test_MapLiteralEntry() async {
// MapLiteralEntry MapLiteral VariableDeclaration
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2859,13 +2859,13 @@ foo = {^''');
test_MapLiteralEntry1() async {
// MapLiteralEntry MapLiteral VariableDeclaration
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2881,13 +2881,13 @@ foo = {T^''');
test_MapLiteralEntry2() async {
// SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -3077,13 +3077,13 @@ class A {Z a(X x, [int y=1]) {^}}''');
test_MethodDeclaration_returnType() async {
// ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -3106,13 +3106,13 @@ class C2 {^ zoo(z) { } String name; }''');
test_MethodDeclaration_returnType_afterComment() async {
// ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -3135,13 +3135,13 @@ class C2 {/* */ ^ zoo(z) { } String name; }''');
test_MethodDeclaration_returnType_afterComment2() async {
// MethodDeclaration ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -3164,13 +3164,13 @@ class C2 {/** */ ^ zoo(z) { } String name; }''');
test_MethodDeclaration_returnType_afterComment3() async {
// MethodDeclaration ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -3272,14 +3272,14 @@ class B extends A {m() {^}}
test_partFile_TypeName() async {
// SimpleIdentifier TypeName ConstructorName
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
library libA;
import "testB.dart";
import "b.dart";
part "${resourceProvider.pathContext.basename(testFile)}";
class A { }
var m;''');
@ -3305,18 +3305,18 @@ main() {new ^}''');
test_partFile_TypeName2() async {
// SimpleIdentifier TypeName ConstructorName
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
part of libA;
class B { }''');
addTestSource('''
library libA;
import "testB.dart";
part "testA.dart";
import "b.dart";
part "a.dart";
class A { A({String boo: 'hoo'}) { } }
main() {new ^}
var m;''');
@ -3338,7 +3338,7 @@ var m;''');
test_PrefixedIdentifier_class_const() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
class I {
static const scI = 'boo';
@ -3352,7 +3352,7 @@ class B implements I {
m(X x) {} I _n(X x) {}}
class X{}''');
addTestSource('''
import "testB.dart";
import "b.dart";
class A extends B {
static const String scA = 'foo';
w() { }}
@ -3385,7 +3385,7 @@ main() {A.^}''');
test_PrefixedIdentifier_class_imported() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
class I {X get f => new A();get _g => new A();}
class A implements I {
@ -3396,7 +3396,7 @@ class A implements I {
m(X x) {} I _n(X x) {}}
class X{}''');
addTestSource('''
import "testB.dart";
import "b.dart";
main() {A a; a.^}''');
await computeSuggestions();
@ -3464,13 +3464,13 @@ class X{}''');
test_PrefixedIdentifier_library() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
class X { }
class Y { }''');
addTestSource('''
import "testB.dart" as b;
import "b.dart" as b;
var T2;
class A { }
main() {b.^}''');
@ -3491,13 +3491,13 @@ main() {b.^}''');
test_PrefixedIdentifier_library_typesOnly() async {
// SimpleIdentifier PrefixedIdentifier TypeName
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
class X { }
class Y { }''');
addTestSource('''
import "testB.dart" as b;
import "b.dart" as b;
var T2;
class A { }
foo(b.^ f) {}''');
@ -3518,13 +3518,13 @@ foo(b.^ f) {}''');
test_PrefixedIdentifier_library_typesOnly2() async {
// SimpleIdentifier PrefixedIdentifier TypeName
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
class X { }
class Y { }''');
addTestSource('''
import "testB.dart" as b;
import "b.dart" as b;
var T2;
class A { }
foo(b.^) {}''');
@ -3545,13 +3545,13 @@ foo(b.^) {}''');
test_PrefixedIdentifier_parameter() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
class _W {M y; var _z;}
class X extends _W {}
class M{}''');
addTestSource('''
import "testB.dart";
import "b.dart";
foo(X x) {x.^}''');
await computeSuggestions();
@ -3564,11 +3564,11 @@ foo(X x) {x.^}''');
test_PrefixedIdentifier_prefix() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
class A {static int bar = 10;}
_B() {}''');
addTestSource('''
import "testA.dart";
import "a.dart";
class X {foo(){A^.bar}}''');
await computeSuggestions();
@ -4040,12 +4040,12 @@ class X{}''');
test_TypeArgumentList() async {
// SimpleIdentifier BinaryExpression ExpressionStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
class C1 {int x;}
F1() => 0;
typedef String T1(int blat);''');
addTestSource('''
import "testA.dart";'
import "a.dart";'
class C2 {int x;}
F2() => 0;
typedef int T2(int blat);
@ -4066,12 +4066,12 @@ main() { C<^> c; }''');
test_TypeArgumentList2() async {
// TypeName TypeArgumentList TypeName
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
class C1 {int x;}
F1() => 0;
typedef String T1(int blat);''');
addTestSource('''
import "testA.dart";'
import "a.dart";'
class C2 {int x;}
F2() => 0;
typedef int T2(int blat);
@ -4088,13 +4088,13 @@ main() { C<C^> c; }''');
test_VariableDeclaration_name() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement Block
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
foo() { }
class _B { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import "b.dart";
class Y {Y.c(); Y._d(); z() {}}
main() {var ^}''');
await computeSuggestions();
@ -4115,13 +4115,13 @@ main() {var ^}''');
test_VariableDeclarationStatement_RHS() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
foo() { }
class _B { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import "b.dart";
class Y {Y.c(); Y._d(); z() {}}
class C {bar(){var f; {var x;} var e = ^}}''');
await computeSuggestions();
@ -4144,14 +4144,14 @@ class C {bar(){var f; {var x;} var e = ^}}''');
test_VariableDeclarationStatement_RHS_missing_semicolon() async {
// VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
foo1() { }
void bar1() { }
class _B { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import "b.dart";
foo2() { }
void bar2() { }
class Y {Y.c(); Y._d(); z() {}}

View file

@ -24,15 +24,15 @@ class LocalLibraryContributorTest extends DartCompletionContributorTest {
test_partFile_Constructor() async {
// SimpleIdentifier TypeName ConstructorName
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
library libA;
import "${convertAbsolutePathToUri("/testB.dart")}";
part "${convertAbsolutePathToUri(testFile)}";
import "b.dart";
part "test.dart";
class A { }
var m;''');
addTestSource('''
@ -58,18 +58,18 @@ class LocalLibraryContributorTest extends DartCompletionContributorTest {
test_partFile_Constructor2() async {
// SimpleIdentifier TypeName ConstructorName
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
part of libA;
class B { }''');
addTestSource('''
library libA;
import "${convertAbsolutePathToUri("/testB.dart")}";
part "${convertAbsolutePathToUri("/testA.dart")}";
import "b.dart";
part "a.dart";
class A { A({String boo: 'hoo'}) { } }
main() {new ^}
var m;''');
@ -92,19 +92,19 @@ class LocalLibraryContributorTest extends DartCompletionContributorTest {
test_partFile_InstanceCreationExpression_assignment_filter() async {
// ConstructorName InstanceCreationExpression VariableDeclarationList
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
part of libA;
class A {} class B extends A {} class C implements A {} class D {}
''');
addTestSource('''
library libA;
import "${convertAbsolutePathToUri("/testB.dart")}";
part "${convertAbsolutePathToUri("/testA.dart")}";
import "b.dart";
part "a.dart";
class Local { }
main() {
A a;
@ -144,19 +144,19 @@ class LocalLibraryContributorTest extends DartCompletionContributorTest {
test_partFile_InstanceCreationExpression_variable_declaration_filter() async {
// ConstructorName InstanceCreationExpression VariableDeclarationList
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
part of libA;
class A {} class B extends A {} class C implements A {} class D {}
''');
addTestSource('''
library libA;
import "${convertAbsolutePathToUri("/testB.dart")}";
part "${convertAbsolutePathToUri("/testA.dart")}";
import "b.dart";
part "a.dart";
class Local { }
main() {
A a = new ^
@ -193,15 +193,15 @@ class LocalLibraryContributorTest extends DartCompletionContributorTest {
}
test_partFile_TypeName() async {
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
library libA;
import "${convertAbsolutePathToUri("/testB.dart")}";
part "${convertAbsolutePathToUri(testFile)}";
import "b.dart";
part "test.dart";
class A { var a1; a2(){}}
var m;
typedef t1(int blue);
@ -238,12 +238,12 @@ class LocalLibraryContributorTest extends DartCompletionContributorTest {
}
test_partFile_TypeName2() async {
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
part of libA;
class B { var b1; b2(){}}
int bf() => 0;
@ -251,8 +251,8 @@ class LocalLibraryContributorTest extends DartCompletionContributorTest {
var n;''');
addTestSource('''
library libA;
import "${convertAbsolutePathToUri("/testB.dart")}";
part "${convertAbsolutePathToUri("/testA.dart")}";
import "b.dart";
part "a.dart";
class A { A({String boo: 'hoo'}) { } }
main() {^}
var m;''');

View file

@ -45,13 +45,13 @@ class NamedConstructorContributorTest extends DartCompletionContributorTest {
test_ConstructorName_importedClass() async {
// SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
// InstanceCreationExpression
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "${convertAbsolutePathToUri("/testB.dart")}";
import 'b.dart';
var m;
main() {new X.^}''');
@ -69,13 +69,13 @@ class NamedConstructorContributorTest extends DartCompletionContributorTest {
test_ConstructorName_importedClass_unresolved() async {
// SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
// InstanceCreationExpression
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "${convertAbsolutePathToUri("/testB.dart")}";
import 'b.dart';
var m;
main() {new X.^}''');
// Assume that imported libraries are NOT resolved
@ -94,13 +94,13 @@ class NamedConstructorContributorTest extends DartCompletionContributorTest {
test_ConstructorName_importedFactory() async {
// SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
// InstanceCreationExpression
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {factory X.c(); factory X._d(); z() {}}''');
addTestSource('''
import "${convertAbsolutePathToUri("/testB.dart")}";
import 'b.dart';
var m;
main() {new X.^}''');

View file

@ -93,16 +93,16 @@ class C extends B {
}
test_fromPart() async {
addSource('/myLib.dart', '''
addSource('/home/test/lib/myLib.dart', '''
library myLib;
part '${convertAbsolutePathToUri(testFile)}'
part '${convertAbsolutePathToUri('/otherPart.dart')}'
part 'test.dart';
part 'otherPart.dart';
class A {
A suggested1(int x) => null;
B suggested2(String y) => null;
}
''');
addSource('/otherPart.dart', '''
addSource('/home/test/lib/otherPart.dart', '''
part of myLib;
class B extends A {
B suggested2(String y) => null;
@ -176,14 +176,14 @@ method() {
}
test_private_otherLibrary() async {
addSource('/lib.dart', '''
addSource('/home/test/lib/a.dart', '''
class A {
void foo() {}
void _bar() {}
}
''');
addTestSource(r'''
import 'lib.dart';
import 'a.dart';
class B extends A {
f^

View file

@ -98,7 +98,7 @@ class StaticMemberContributorTest extends DartCompletionContributorTest {
}
test_implicitCreation() async {
addSource('/a.dart', '''
addSource('/home/test/lib/a.dart', '''
class A {
A.foo();
A.bar();
@ -261,7 +261,7 @@ void main() {async.Future.^.w()}''');
test_PrefixedIdentifier_class_const() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
class I {
static const scI = 'boo';
@ -275,7 +275,7 @@ void main() {async.Future.^.w()}''');
m(X x) {} I _n(X x) {}}
class X{}''');
addTestSource('''
import "/testB.dart";
import "b.dart";
class A extends B {
static const String scA = 'foo';
w() { }}

View file

@ -113,12 +113,12 @@ void main() {new A().f^}''');
test_ArgumentList() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B { }
String bar() => true;
void main() {expect(^)}''');
@ -138,13 +138,13 @@ void main() {new A().f^}''');
test_ArgumentList_imported_function() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(arg) { }
void baz() { }''');
addTestSource('''
import 'libA.dart'
import 'a.dart';
class B { }
String bar() => true;
void main() {expect(^)}''');
@ -164,14 +164,14 @@ void main() {new A().f^}''');
test_ArgumentList_InstanceCreationExpression_functionalArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'dart:async';
import 'libA.dart';
import 'a.dart';
class B { }
String bar() => true;
void main() {new A(^)}''');
@ -192,7 +192,7 @@ void main() {new A().f^}''');
test_ArgumentList_InstanceCreationExpression_typedefArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
typedef Funct();
class A { A(Funct f) { } }
@ -200,7 +200,7 @@ void main() {new A().f^}''');
void baz() { }''');
addTestSource('''
import 'dart:async';
import 'libA.dart';
import 'a.dart';
class B { }
String bar() => true;
void main() {new A(^)}''');
@ -221,12 +221,12 @@ void main() {new A().f^}''');
test_ArgumentList_local_function() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'libA.dart'
import 'a.dart';
expect(arg) { }
class B { }
String bar() => true;
@ -247,12 +247,12 @@ void main() {new A().f^}''');
test_ArgumentList_local_method() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'libA.dart'
import 'a.dart';
class B {
expect(arg) { }
void foo() {expect(^)}}
@ -273,14 +273,14 @@ void main() {new A().f^}''');
test_ArgumentList_MethodInvocation_functionalArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'dart:async';
import 'libA.dart';
import 'a.dart';
class B { }
String bar(f()) => true;
void main() {bar(^);}''');
@ -301,14 +301,14 @@ void main() {new A().f^}''');
test_ArgumentList_MethodInvocation_methodArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'dart:async';
import 'libA.dart';
import 'a.dart';
class B { String bar(f()) => true; }
void main() {new B().bar(^);}''');
await computeSuggestions();
@ -328,11 +328,11 @@ void main() {new A().f^}''');
test_ArgumentList_namedParam() async {
// SimpleIdentifier NamedExpression ArgumentList MethodInvocation
// ExpressionStatement
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }''');
addTestSource('''
import 'libA.dart'
import 'a.dart';
String bar() => true;
void main() {expect(foo: ^)}''');
await computeSuggestions();
@ -983,14 +983,14 @@ void main() {new A().f^}''');
test_Block_inherited_imported() async {
// Block BlockFunctionBody MethodDeclaration ClassDeclaration
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; }
class E extends F { var e1; e2() { } }
class I { int i1; i2() { } }
class M { var m1; int m2() { } }''');
addTestSource('''
import "testB.dart";
import "b.dart";
class A extends E implements I with M {a() {^}}''');
await computeSuggestions();
@ -1099,10 +1099,10 @@ void main() {new A().f^}''');
test_CascadeExpression_method1() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart";
import "b.dart";
class A {var b; X _c;}
class X{}
// looks like a cascade to the parser
@ -1123,10 +1123,10 @@ void main() {new A().f^}''');
test_CascadeExpression_selector1() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart";
import "b.dart";
class A {var b; X _c;}
class X{}
// looks like a cascade to the parser
@ -1147,10 +1147,10 @@ void main() {new A().f^}''');
test_CascadeExpression_selector2() async {
// SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart";
import "b.dart";
class A {var b; X _c;}
class X{}
main() {A a; a..^z}''');
@ -1169,10 +1169,10 @@ void main() {new A().f^}''');
test_CascadeExpression_selector2_withTrailingReturn() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart";
import "b.dart";
class A {var b; X _c;}
class X{}
main() {A a; a..^ return}''');
@ -1258,10 +1258,10 @@ void main() {new A().f^}''');
test_ClassDeclaration_body() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import "b.dart" as x;
@deprecated class A {^}
class _B {}
A T;''');
@ -1277,10 +1277,10 @@ void main() {new A().f^}''');
test_ClassDeclaration_body_final() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import "b.dart" as x;
class A {final ^}
class _B {}
A T;''');
@ -1296,10 +1296,10 @@ void main() {new A().f^}''');
test_ClassDeclaration_body_final_field() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import "b.dart" as x;
class A {final ^ A(){}}
class _B {}
A T;''');
@ -1315,10 +1315,10 @@ void main() {new A().f^}''');
test_ClassDeclaration_body_final_field2() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as Soo;
import "b.dart" as Soo;
class A {final S^ A();}
class _B {}
A Sew;''');
@ -1334,10 +1334,10 @@ void main() {new A().f^}''');
test_ClassDeclaration_body_final_final() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import "b.dart" as x;
class A {final ^ final foo;}
class _B {}
A T;''');
@ -1353,10 +1353,10 @@ void main() {new A().f^}''');
test_ClassDeclaration_body_final_var() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import "b.dart" as x;
class A {final ^ var foo;}
class _B {}
A T;''');
@ -1420,12 +1420,12 @@ void main() {new A().f^}''');
test_ConditionalExpression_elseExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -1439,12 +1439,12 @@ void main() {new A().f^}''');
test_ConditionalExpression_elseExpression_empty() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -1464,12 +1464,12 @@ void main() {new A().f^}''');
test_ConditionalExpression_partial_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -1483,12 +1483,12 @@ void main() {new A().f^}''');
test_ConditionalExpression_partial_thenExpression_empty() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -1508,12 +1508,12 @@ void main() {new A().f^}''');
test_ConditionalExpression_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -1528,13 +1528,13 @@ void main() {new A().f^}''');
test_ConstructorName_importedClass() async {
// SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
// InstanceCreationExpression
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import "b.dart";
var m;
main() {new X.^}''');
await computeSuggestions();
@ -1552,13 +1552,13 @@ void main() {new A().f^}''');
test_ConstructorName_importedFactory() async {
// SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
// InstanceCreationExpression
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {factory X.c(); factory X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import "b.dart";
var m;
main() {new X.^}''');
await computeSuggestions();
@ -1712,12 +1712,12 @@ void main() {new A().f^}''');
test_ExpressionStatement_identifier() async {
// SimpleIdentifier ExpressionStatement Block
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
_B F1() { }
class A {int x;}
class _B { }''');
addTestSource('''
import "testA.dart";
import "a.dart";
typedef int F2(int blat);
class Clz = Object with Object;
class C {foo(){^} void bar() {}}''');
@ -1738,11 +1738,11 @@ void main() {new A().f^}''');
test_ExpressionStatement_name() async {
// ExpressionStatement Block BlockFunctionBody MethodDeclaration
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
B T1;
class B{}''');
addTestSource('''
import "testA.dart";
import "a.dart";
class C {a() {C ^}}''');
await computeSuggestions();
assertNoSuggestions();
@ -1751,9 +1751,9 @@ void main() {new A().f^}''');
test_FieldDeclaration_name_typed() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
addSource('/testA.dart', 'class A { }');
addSource('/home/test/lib/a.dart', 'class A { }');
addTestSource('''
import "testA.dart";
import "a.dart";
class C {A ^}''');
await computeSuggestions();
assertNoSuggestions();
@ -1762,9 +1762,9 @@ void main() {new A().f^}''');
test_FieldDeclaration_name_var() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
addSource('/testA.dart', 'class A { }');
addSource('/home/test/lib/a.dart', 'class A { }');
addTestSource('''
import "testA.dart";
import "a.dart";
class C {var ^}''');
await computeSuggestions();
assertNoSuggestions();
@ -1914,13 +1914,13 @@ void main() {new A().f^}''');
test_FunctionDeclaration_returnType_afterComment() async {
// ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -1943,13 +1943,13 @@ void main() {new A().f^}''');
test_FunctionDeclaration_returnType_afterComment2() async {
// FunctionDeclaration ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -1972,13 +1972,13 @@ void main() {new A().f^}''');
test_FunctionDeclaration_returnType_afterComment3() async {
// FunctionDeclaration ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2141,12 +2141,12 @@ void f(C<int> c) {
test_IndexExpression() async {
// ExpressionStatement Block
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -2166,12 +2166,12 @@ void f(C<int> c) {
test_IndexExpression2() async {
// SimpleIdentifier IndexExpression ExpressionStatement Block
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -2185,12 +2185,12 @@ void f(C<int> c) {
test_InstanceCreationExpression_imported() async {
// SimpleIdentifier TypeName ConstructorName InstanceCreationExpression
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {A(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
import "dart:async";
int T2;
F2() { }
@ -2226,13 +2226,13 @@ void f(C<int> c) {
test_InterpolationExpression() async {
// SimpleIdentifier InterpolationExpression StringInterpolation
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2255,13 +2255,13 @@ void f(C<int> c) {
test_InterpolationExpression_block() async {
// SimpleIdentifier InterpolationExpression StringInterpolation
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2321,12 +2321,12 @@ void f(C<int> c) {
test_IsExpression() async {
// SimpleIdentifier TypeName IsExpression IfStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
foo() { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import "b.dart";
class Y {Y.c(); Y._d(); z() {}}
main() {var x; if (x is ^) { }}''');
await computeSuggestions();
@ -2393,14 +2393,14 @@ void f(C<int> c) {
}
test_keyword2() async {
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int newT1;
int T1;
nowIsIt() { }
class X {factory X.c(); factory X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import "b.dart";
String newer() {}
var m;
main() {new^ X.c();}''');
@ -2453,9 +2453,9 @@ void f(C<int> c) {
}
test_libraryPrefix_with_exports() async {
addSource('/libA.dart', 'library libA; class A { }');
addSource('/libB.dart', 'library libB; export "libA.dart"; class B { }');
addTestSource('import "libB.dart" as foo; main() {foo.^} class C { }');
addSource('/home/test/lib/a.dart', 'class A { }');
addSource('/home/test/lib/b.dart', 'export "a.dart"; class B { }');
addTestSource('import "b.dart" as foo; main() {foo.^} class C { }');
await computeSuggestions();
// Suggested by LibraryMemberContributor
assertNotSuggested('B');
@ -2512,13 +2512,13 @@ void f(C<int> c) {
test_MapLiteralEntry() async {
// MapLiteralEntry MapLiteral VariableDeclaration
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2539,13 +2539,13 @@ void f(C<int> c) {
test_MapLiteralEntry1() async {
// MapLiteralEntry MapLiteral VariableDeclaration
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2559,13 +2559,13 @@ void f(C<int> c) {
test_MapLiteralEntry2() async {
// SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2768,13 +2768,13 @@ void main() {new C().^}''');
test_MethodDeclaration_returnType() async {
// ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2796,13 +2796,13 @@ void main() {new C().^}''');
test_MethodDeclaration_returnType_afterComment() async {
// ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2824,13 +2824,13 @@ void main() {new C().^}''');
test_MethodDeclaration_returnType_afterComment2() async {
// MethodDeclaration ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2852,13 +2852,13 @@ void main() {new C().^}''');
test_MethodDeclaration_returnType_afterComment3() async {
// MethodDeclaration ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -3049,14 +3049,14 @@ void main() {C.^ print("something");}''');
test_partFile_TypeName() async {
// SimpleIdentifier TypeName ConstructorName
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
library libA;
import "testB.dart";
import "b.dart";
part "${resourceProvider.pathContext.basename(testFile)}";
class A { }
var m;''');
@ -3081,18 +3081,18 @@ void main() {C.^ print("something");}''');
test_partFile_TypeName2() async {
// SimpleIdentifier TypeName ConstructorName
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
part of libA;
class B { }''');
addTestSource('''
library libA;
import "testB.dart";
part "${convertAbsolutePathToUri('/testA.dart')}";
import "b.dart";
part "a.dart";
class A { A({String boo: 'hoo'}) { } }
main() {new ^}
var m;''');
@ -3113,7 +3113,7 @@ void main() {C.^ print("something");}''');
test_PrefixedIdentifier_class_const() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
class I {
static const scI = 'boo';
@ -3127,7 +3127,7 @@ void main() {C.^ print("something");}''');
m(X x) {} I _n(X x) {}}
class X{}''');
addTestSource('''
import "testB.dart";
import "b.dart";
class A extends B {
static const String scA = 'foo';
w() { }}
@ -3159,7 +3159,7 @@ void main() {C.^ print("something");}''');
test_PrefixedIdentifier_class_imported() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
class I {X get f => new A();get _g => new A();}
class A implements I {
@ -3170,7 +3170,7 @@ void main() {C.^ print("something");}''');
m(X x) {} I _n(X x) {}}
class X{}''');
addTestSource('''
import "testB.dart";
import "b.dart";
main() {A a; a.^}''');
await computeSuggestions();
expect(replacementOffset, completionOffset);
@ -3235,13 +3235,13 @@ void main() {C.^ print("something");}''');
test_PrefixedIdentifier_library() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
class X { }
class Y { }''');
addTestSource('''
import "testB.dart" as b;
import "b.dart" as b;
var T2;
class A { }
main() {b.^}''');
@ -3261,13 +3261,13 @@ void main() {C.^ print("something");}''');
test_PrefixedIdentifier_library_typesOnly() async {
// SimpleIdentifier PrefixedIdentifier TypeName
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
class X { }
class Y { }''');
addTestSource('''
import "testB.dart" as b;
import "b.dart" as b;
var T2;
class A { }
foo(b.^ f) {}''');
@ -3287,13 +3287,13 @@ void main() {C.^ print("something");}''');
test_PrefixedIdentifier_library_typesOnly2() async {
// SimpleIdentifier PrefixedIdentifier TypeName
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
class X { }
class Y { }''');
addTestSource('''
import "testB.dart" as b;
import "b.dart" as b;
var T2;
class A { }
foo(b.^) {}''');
@ -3313,13 +3313,13 @@ void main() {C.^ print("something");}''');
test_PrefixedIdentifier_parameter() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
class _W {M y; var _z;}
class X extends _W {}
class M{}''');
addTestSource('''
import "testB.dart";
import "b.dart";
foo(X x) {x.^}''');
await computeSuggestions();
expect(replacementOffset, completionOffset);
@ -3331,11 +3331,11 @@ void main() {C.^ print("something");}''');
test_PrefixedIdentifier_prefix() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
class A {static int bar = 10;}
_B() {}''');
addTestSource('''
import "testA.dart";
import "a.dart";
class X {foo(){A^.bar}}''');
await computeSuggestions();
expect(replacementOffset, completionOffset - 1);
@ -3917,12 +3917,12 @@ class C with M {
test_TypeArgumentList() async {
// SimpleIdentifier BinaryExpression ExpressionStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
class C1 {int x;}
F1() => 0;
typedef String T1(int blat);''');
addTestSource('''
import "testA.dart";'
import "a.dart";'
class C2 {int x;}
F2() => 0;
typedef int T2(int blat);
@ -3942,12 +3942,12 @@ class C with M {
test_TypeArgumentList2() async {
// TypeName TypeArgumentList TypeName
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
class C1 {int x;}
F1() => 0;
typedef String T1(int blat);''');
addTestSource('''
import "testA.dart";'
import "a.dart";'
class C2 {int x;}
F2() => 0;
typedef int T2(int blat);
@ -3963,13 +3963,13 @@ class C with M {
test_VariableDeclaration_name() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement Block
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
foo() { }
class _B { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import "b.dart";
class Y {Y.c(); Y._d(); z() {}}
main() {var ^}''');
await computeSuggestions();
@ -3988,13 +3988,13 @@ class C with M {
test_VariableDeclarationStatement_RHS() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
foo() { }
class _B { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import "b.dart";
class Y {Y.c(); Y._d(); z() {}}
class C {bar(){var f; {var x;} var e = ^}}''');
await computeSuggestions();
@ -4012,14 +4012,14 @@ class C with M {
test_VariableDeclarationStatement_RHS_missing_semicolon() async {
// VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
foo1() { }
void bar1() { }
class _B { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import "b.dart";
foo2() { }
void bar2() { }
class Y {Y.c(); Y._d(); z() {}}

View file

@ -561,7 +561,7 @@ abstract class DartCompletionContributorTest extends AbstractContextTest {
@override
void setUp() {
super.setUp();
testFile = convertPath('/completionTest.dart');
testFile = convertPath('/home/test/lib/test.dart');
contributor = createContributor();
}
}

View file

@ -29,7 +29,7 @@ class InheritedReferenceContributorTest extends DartCompletionContributorTest {
/// Sanity check. Permutations tested in local_ref_contributor.
test_ArgDefaults_inherited_method_with_required_named() async {
addMetaPackage();
resolveSource('/testB.dart', '''
resolveSource('/home/test/lib/b.dart', '''
import 'package:meta/meta.dart';
lib libB;
@ -37,7 +37,7 @@ class A {
bool foo(int bar, {bool boo, @required int baz}) => false;
}''');
addTestSource('''
import "testB.dart";
import 'b.dart';
class B extends A {
b() => f^
}
@ -50,13 +50,13 @@ class B extends A {
test_AwaitExpression_inherited() async {
// SimpleIdentifier AwaitExpression ExpressionStatement
resolveSource('/testB.dart', '''
resolveSource('/home/test/lib/b.dart', '''
lib libB;
class A {
Future y() async {return 0;}
}''');
addTestSource('''
import "testB.dart";
import 'b.dart';
class B extends A {
Future a() async {return 0;}
foo() async {await ^}
@ -76,14 +76,14 @@ class B extends A {
test_Block_inherited_imported() async {
// Block BlockFunctionBody MethodDeclaration ClassDeclaration
resolveSource('/testB.dart', '''
resolveSource('/home/test/lib/b.dart', '''
lib B;
class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; }
class E extends F { var e1; e2() { } }
class I { int i1; i2() { } }
class M { var m1; int m2() { } }''');
addTestSource('''
import "testB.dart";
import 'b.dart';
class A extends E implements I with M {a() {^}}''');
await computeSuggestions();
expect(replacementOffset, completionOffset);
@ -126,7 +126,7 @@ class A extends E implements I with M {a() {^}}''');
}
test_inherited() async {
resolveSource('/testB.dart', '''
resolveSource('/home/test/lib/b.dart', '''
lib libB;
class A2 {
int x;
@ -135,7 +135,7 @@ class A2 {
int y2() {return 0;}
}''');
addTestSource('''
import "testB.dart";
import 'b.dart';
class A1 {
int x;
int y() {return 0;}
@ -178,13 +178,13 @@ class A {
}
test_method_parameters_mixed_required_and_named() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
void m(x, {int y}) {}
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -221,13 +221,13 @@ class B extends A {
}
test_method_parameters_mixed_required_and_positional() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
void m(x, [int y]) {}
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -264,13 +264,13 @@ class B extends A {
}
test_method_parameters_named() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
void m({x, int y}) {}
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -307,13 +307,13 @@ class B extends A {
}
test_method_parameters_none() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
void m() {}
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -344,13 +344,13 @@ class B extends A {
}
test_method_parameters_positional() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
void m([x, int y]) {}
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -387,13 +387,13 @@ class B extends A {
}
test_method_parameters_required() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
void m(x, int y) {}
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -410,7 +410,7 @@ class B extends A {
}
test_mixin_ordering() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class B {}
class M1 {
void m() {}
@ -420,7 +420,7 @@ class M2 {
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class C extends B with M1, M2 {
void f() {
^
@ -432,13 +432,13 @@ class C extends B with M1, M2 {
}
test_no_parameters_field() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
int x;
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -449,13 +449,13 @@ class B extends A {
}
test_no_parameters_getter() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
int get x => null;
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -466,13 +466,13 @@ class B extends A {
}
test_no_parameters_setter() async {
resolveSource('/libA.dart', '''
resolveSource('/home/test/lib/a.dart', '''
class A {
set x(int value) {};
}
''');
addTestSource('''
import 'libA.dart';
import 'a.dart';
class B extends A {
main() {^}
}
@ -483,7 +483,7 @@ class B extends A {
}
test_outside_class() async {
resolveSource('/testB.dart', '''
resolveSource('/home/test/lib/b.dart', '''
lib libB;
class A2 {
int x;
@ -492,7 +492,7 @@ class A2 {
int y2() {return 0;}
}''');
addTestSource('''
import "testB.dart";
import 'b.dart';
class A1 {
int x;
int y() {return 0;}
@ -524,7 +524,7 @@ foo() {^}
}
test_static_field() async {
resolveSource('/testB.dart', '''
resolveSource('/home/test/lib/b.dart', '''
lib libB;
class A2 {
int x;
@ -533,7 +533,7 @@ class A2 {
int y2() {return 0;}
}''');
addTestSource('''
import "testB.dart";
import 'b.dart';
class A1 {
int x;
int y() {return 0;}
@ -565,7 +565,7 @@ class B extends A1 with A2 {
}
test_static_method() async {
resolveSource('/testB.dart', '''
resolveSource('/home/test/lib/b.dart', '''
lib libB;
class A2 {
int x;
@ -574,7 +574,7 @@ class A2 {
int y2() {return 0;}
}''');
addTestSource('''
import "testB.dart";
import 'b.dart';
class A1 {
int x;
int y() {return 0;}

View file

@ -114,12 +114,12 @@ void main() {new A().f^}''');
test_ArgumentList() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'libA.dart';
import 'a.dart';;
class B { }
String bar() => true;
void main() {expect(^)}''');
@ -139,13 +139,13 @@ void main() {new A().f^}''');
test_ArgumentList_imported_function() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(arg) { }
void baz() { }''');
addTestSource('''
import 'libA.dart'
import 'a.dart';
class B { }
String bar() => true;
void main() {expect(^)}''');
@ -165,14 +165,14 @@ void main() {new A().f^}''');
test_ArgumentList_InstanceCreationExpression_functionalArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'dart:async';
import 'libA.dart';
import 'a.dart';;
class B { }
String bar() => true;
void main() {new A(^)}''');
@ -193,7 +193,7 @@ void main() {new A().f^}''');
test_ArgumentList_InstanceCreationExpression_typedefArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
typedef Funct();
class A { A(Funct f) { } }
@ -201,7 +201,7 @@ void main() {new A().f^}''');
void baz() { }''');
addTestSource('''
import 'dart:async';
import 'libA.dart';
import 'a.dart';;
class B { }
String bar() => true;
void main() {new A(^)}''');
@ -222,12 +222,12 @@ void main() {new A().f^}''');
test_ArgumentList_local_function() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'libA.dart'
import 'a.dart';
expect(arg) { }
class B { }
String bar() => true;
@ -248,12 +248,12 @@ void main() {new A().f^}''');
test_ArgumentList_local_method() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'libA.dart'
import 'a.dart';
class B {
expect(arg) { }
void foo() {expect(^)}}
@ -274,14 +274,14 @@ void main() {new A().f^}''');
test_ArgumentList_MethodInvocation_functionalArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'dart:async';
import 'libA.dart';
import 'a.dart';;
class B { }
String bar(f()) => true;
void main() {bar(^);}''');
@ -302,14 +302,14 @@ void main() {new A().f^}''');
test_ArgumentList_MethodInvocation_methodArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
import 'dart:async';
import 'libA.dart';
import 'a.dart';;
class B { String bar(f()) => true; }
void main() {new B().bar(^);}''');
await computeSuggestions();
@ -329,11 +329,11 @@ void main() {new A().f^}''');
test_ArgumentList_namedParam() async {
// SimpleIdentifier NamedExpression ArgumentList MethodInvocation
// ExpressionStatement
addSource('/libA.dart', '''
addSource('/home/test/lib/a.dart', '''
library A;
bool hasLength(int expected) { }''');
addTestSource('''
import 'libA.dart'
import 'a.dart';
String bar() => true;
void main() {expect(foo: ^)}''');
await computeSuggestions();
@ -984,14 +984,14 @@ void main() {new A().f^}''');
test_Block_inherited_imported() async {
// Block BlockFunctionBody MethodDeclaration ClassDeclaration
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; }
class E extends F { var e1; e2() { } }
class I { int i1; i2() { } }
class M { var m1; int m2() { } }''');
addTestSource('''
import "testB.dart";
import 'b.dart';
class A extends E implements I with M {a() {^}}''');
await computeSuggestions();
@ -1102,10 +1102,10 @@ void main() {new A().f^}''');
test_CascadeExpression_method1() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart";
import 'b.dart';
class A {var b; X _c;}
class X{}
// looks like a cascade to the parser
@ -1126,10 +1126,10 @@ void main() {new A().f^}''');
test_CascadeExpression_selector1() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart";
import 'b.dart';
class A {var b; X _c;}
class X{}
// looks like a cascade to the parser
@ -1150,10 +1150,10 @@ void main() {new A().f^}''');
test_CascadeExpression_selector2() async {
// SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart";
import 'b.dart';
class A {var b; X _c;}
class X{}
main() {A a; a..^z}''');
@ -1172,10 +1172,10 @@ void main() {new A().f^}''');
test_CascadeExpression_selector2_withTrailingReturn() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart";
import 'b.dart';
class A {var b; X _c;}
class X{}
main() {A a; a..^ return}''');
@ -1261,10 +1261,10 @@ void main() {new A().f^}''');
test_ClassDeclaration_body() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import 'b.dart'; as x;
@deprecated class A {^}
class _B {}
A T;''');
@ -1280,10 +1280,10 @@ void main() {new A().f^}''');
test_ClassDeclaration_body_final() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import 'b.dart'; as x;
class A {final ^}
class _B {}
A T;''');
@ -1299,10 +1299,10 @@ void main() {new A().f^}''');
test_ClassDeclaration_body_final_field() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import 'b.dart'; as x;
class A {final ^ A(){}}
class _B {}
A T;''');
@ -1318,10 +1318,10 @@ void main() {new A().f^}''');
test_ClassDeclaration_body_final_field2() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as Soo;
import 'b.dart'; as Soo;
class A {final S^ A();}
class _B {}
A Sew;''');
@ -1337,10 +1337,10 @@ void main() {new A().f^}''');
test_ClassDeclaration_body_final_final() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import 'b.dart'; as x;
class A {final ^ final foo;}
class _B {}
A T;''');
@ -1356,10 +1356,10 @@ void main() {new A().f^}''');
test_ClassDeclaration_body_final_var() async {
// ClassDeclaration CompilationUnit
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
class B { }''');
addTestSource('''
import "testB.dart" as x;
import 'b.dart'; as x;
class A {final ^ var foo;}
class _B {}
A T;''');
@ -1423,12 +1423,12 @@ void main() {new A().f^}''');
test_ConditionalExpression_elseExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -1442,12 +1442,12 @@ void main() {new A().f^}''');
test_ConditionalExpression_elseExpression_empty() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -1467,12 +1467,12 @@ void main() {new A().f^}''');
test_ConditionalExpression_partial_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -1486,12 +1486,12 @@ void main() {new A().f^}''');
test_ConditionalExpression_partial_thenExpression_empty() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -1511,12 +1511,12 @@ void main() {new A().f^}''');
test_ConditionalExpression_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -1531,13 +1531,13 @@ void main() {new A().f^}''');
test_ConstructorName_importedClass() async {
// SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
// InstanceCreationExpression
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import 'b.dart';
var m;
main() {new X.^}''');
await computeSuggestions();
@ -1555,13 +1555,13 @@ void main() {new A().f^}''');
test_ConstructorName_importedFactory() async {
// SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
// InstanceCreationExpression
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {factory X.c(); factory X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import 'b.dart';
var m;
main() {new X.^}''');
await computeSuggestions();
@ -1715,12 +1715,12 @@ void main() {new A().f^}''');
test_ExpressionStatement_identifier() async {
// SimpleIdentifier ExpressionStatement Block
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
_B F1() { }
class A {int x;}
class _B { }''');
addTestSource('''
import "testA.dart";
import "a.dart";
typedef int F2(int blat);
class Clz = Object with Object;
class C {foo(){^} void bar() {}}''');
@ -1741,11 +1741,11 @@ void main() {new A().f^}''');
test_ExpressionStatement_name() async {
// ExpressionStatement Block BlockFunctionBody MethodDeclaration
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
B T1;
class B{}''');
addTestSource('''
import "testA.dart";
import "a.dart";
class C {a() {C ^}}''');
await computeSuggestions();
assertNoSuggestions();
@ -1754,9 +1754,9 @@ void main() {new A().f^}''');
test_FieldDeclaration_name_typed() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
addSource('/testA.dart', 'class A { }');
addSource('/home/test/lib/a.dart', 'class A { }');
addTestSource('''
import "testA.dart";
import "a.dart";
class C {A ^}''');
await computeSuggestions();
assertNoSuggestions();
@ -1765,9 +1765,9 @@ void main() {new A().f^}''');
test_FieldDeclaration_name_var() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
addSource('/testA.dart', 'class A { }');
addSource('/home/test/lib/a.dart', 'class A { }');
addTestSource('''
import "testA.dart";
import "a.dart";
class C {var ^}''');
await computeSuggestions();
assertNoSuggestions();
@ -1917,13 +1917,13 @@ void main() {new A().f^}''');
test_FunctionDeclaration_returnType_afterComment() async {
// ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -1946,13 +1946,13 @@ void main() {new A().f^}''');
test_FunctionDeclaration_returnType_afterComment2() async {
// FunctionDeclaration ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -1975,13 +1975,13 @@ void main() {new A().f^}''');
test_FunctionDeclaration_returnType_afterComment3() async {
// FunctionDeclaration ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2144,12 +2144,12 @@ void f(C<int> c) {
test_IndexExpression() async {
// ExpressionStatement Block
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -2169,12 +2169,12 @@ void f(C<int> c) {
test_IndexExpression2() async {
// SimpleIdentifier IndexExpression ExpressionStatement Block
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
class B {int x;}
@ -2188,12 +2188,12 @@ void f(C<int> c) {
test_InstanceCreationExpression_imported() async {
// SimpleIdentifier TypeName ConstructorName InstanceCreationExpression
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
class A {A(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
import "dart:async";
int T2;
F2() { }
@ -2229,13 +2229,13 @@ void f(C<int> c) {
test_InterpolationExpression() async {
// SimpleIdentifier InterpolationExpression StringInterpolation
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2258,13 +2258,13 @@ void f(C<int> c) {
test_InterpolationExpression_block() async {
// SimpleIdentifier InterpolationExpression StringInterpolation
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2324,12 +2324,12 @@ void f(C<int> c) {
test_IsExpression() async {
// SimpleIdentifier TypeName IsExpression IfStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
foo() { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import 'b.dart';
class Y {Y.c(); Y._d(); z() {}}
main() {var x; if (x is ^) { }}''');
await computeSuggestions();
@ -2396,14 +2396,14 @@ void f(C<int> c) {
}
test_keyword2() async {
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int newT1;
int T1;
nowIsIt() { }
class X {factory X.c(); factory X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import 'b.dart';
String newer() {}
var m;
main() {new^ X.c();}''');
@ -2456,9 +2456,9 @@ void f(C<int> c) {
}
test_libraryPrefix_with_exports() async {
addSource('/libA.dart', 'library libA; class A { }');
addSource('/libB.dart', 'library libB; export "libA.dart"; class B { }');
addTestSource('import "libB.dart" as foo; main() {foo.^} class C { }');
addSource('/home/test/lib/a.dart', 'class A { }');
addSource('/home/test/lib/b.dart', 'export "a.dart"; class B { }');
addTestSource('import "b.dart" as foo; main() {foo.^} class C { }');
await computeSuggestions();
// Suggested by LibraryMemberContributor
assertNotSuggested('B');
@ -2515,13 +2515,13 @@ void f(C<int> c) {
test_MapLiteralEntry() async {
// MapLiteralEntry MapLiteral VariableDeclaration
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2542,13 +2542,13 @@ void f(C<int> c) {
test_MapLiteralEntry1() async {
// MapLiteralEntry MapLiteral VariableDeclaration
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2562,13 +2562,13 @@ void f(C<int> c) {
test_MapLiteralEntry2() async {
// SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2771,13 +2771,13 @@ void main() {new C().^}''');
test_MethodDeclaration_returnType() async {
// ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2799,13 +2799,13 @@ void main() {new C().^}''');
test_MethodDeclaration_returnType_afterComment() async {
// ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2827,13 +2827,13 @@ void main() {new C().^}''');
test_MethodDeclaration_returnType_afterComment2() async {
// MethodDeclaration ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -2855,13 +2855,13 @@ void main() {new C().^}''');
test_MethodDeclaration_returnType_afterComment3() async {
// MethodDeclaration ClassDeclaration CompilationUnit
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
int T1;
F1() { }
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
import "testA.dart";
import "a.dart";
int T2;
F2() { }
typedef D2();
@ -3052,14 +3052,14 @@ void main() {C.^ print("something");}''');
test_partFile_TypeName() async {
// SimpleIdentifier TypeName ConstructorName
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
library libA;
import "testB.dart";
import 'b.dart';
part "$testFile";
class A { }
var m;''');
@ -3084,18 +3084,18 @@ void main() {C.^ print("something");}''');
test_partFile_TypeName2() async {
// SimpleIdentifier TypeName ConstructorName
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
part of libA;
class B { }''');
addTestSource('''
library libA;
import "testB.dart";
part "testA.dart";
import 'b.dart';
part "a.dart";
class A { A({String boo: 'hoo'}) { } }
main() {new ^}
var m;''');
@ -3116,7 +3116,7 @@ void main() {C.^ print("something");}''');
test_PrefixedIdentifier_class_const() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
class I {
static const scI = 'boo';
@ -3130,7 +3130,7 @@ void main() {C.^ print("something");}''');
m(X x) {} I _n(X x) {}}
class X{}''');
addTestSource('''
import "testB.dart";
import 'b.dart';
class A extends B {
static const String scA = 'foo';
w() { }}
@ -3162,7 +3162,7 @@ void main() {C.^ print("something");}''');
test_PrefixedIdentifier_class_imported() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
class I {X get f => new A();get _g => new A();}
class A implements I {
@ -3173,7 +3173,7 @@ void main() {C.^ print("something");}''');
m(X x) {} I _n(X x) {}}
class X{}''');
addTestSource('''
import "testB.dart";
import 'b.dart';
main() {A a; a.^}''');
await computeSuggestions();
expect(replacementOffset, completionOffset);
@ -3238,13 +3238,13 @@ void main() {C.^ print("something");}''');
test_PrefixedIdentifier_library() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
class X { }
class Y { }''');
addTestSource('''
import "testB.dart" as b;
import 'b.dart'; as b;
var T2;
class A { }
main() {b.^}''');
@ -3264,13 +3264,13 @@ void main() {C.^ print("something");}''');
test_PrefixedIdentifier_library_typesOnly() async {
// SimpleIdentifier PrefixedIdentifier TypeName
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
class X { }
class Y { }''');
addTestSource('''
import "testB.dart" as b;
import 'b.dart'; as b;
var T2;
class A { }
foo(b.^ f) {}''');
@ -3290,13 +3290,13 @@ void main() {C.^ print("something");}''');
test_PrefixedIdentifier_library_typesOnly2() async {
// SimpleIdentifier PrefixedIdentifier TypeName
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
var T1;
class X { }
class Y { }''');
addTestSource('''
import "testB.dart" as b;
import 'b.dart'; as b;
var T2;
class A { }
foo(b.^) {}''');
@ -3316,13 +3316,13 @@ void main() {C.^ print("something");}''');
test_PrefixedIdentifier_parameter() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
class _W {M y; var _z;}
class X extends _W {}
class M{}''');
addTestSource('''
import "testB.dart";
import 'b.dart';
foo(X x) {x.^}''');
await computeSuggestions();
expect(replacementOffset, completionOffset);
@ -3334,11 +3334,11 @@ void main() {C.^ print("something");}''');
test_PrefixedIdentifier_prefix() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
class A {static int bar = 10;}
_B() {}''');
addTestSource('''
import "testA.dart";
import "a.dart";
class X {foo(){A^.bar}}''');
await computeSuggestions();
expect(replacementOffset, completionOffset - 1);
@ -3903,12 +3903,12 @@ class C1 extends C2 implements C3 {
test_TypeArgumentList() async {
// SimpleIdentifier BinaryExpression ExpressionStatement
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
class C1 {int x;}
F1() => 0;
typedef String T1(int blat);''');
addTestSource('''
import "testA.dart";'
import "a.dart";'
class C2 {int x;}
F2() => 0;
typedef int T2(int blat);
@ -3928,12 +3928,12 @@ class C1 extends C2 implements C3 {
test_TypeArgumentList2() async {
// TypeName TypeArgumentList TypeName
addSource('/testA.dart', '''
addSource('/home/test/lib/a.dart', '''
class C1 {int x;}
F1() => 0;
typedef String T1(int blat);''');
addTestSource('''
import "testA.dart";'
import "a.dart";'
class C2 {int x;}
F2() => 0;
typedef int T2(int blat);
@ -3949,13 +3949,13 @@ class C1 extends C2 implements C3 {
test_VariableDeclaration_name() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement Block
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
foo() { }
class _B { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import 'b.dart';
class Y {Y.c(); Y._d(); z() {}}
main() {var ^}''');
await computeSuggestions();
@ -3974,13 +3974,13 @@ class C1 extends C2 implements C3 {
test_VariableDeclarationStatement_RHS() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
foo() { }
class _B { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import 'b.dart';
class Y {Y.c(); Y._d(); z() {}}
class C {bar(){var f; {var x;} var e = ^}}''');
await computeSuggestions();
@ -3998,14 +3998,14 @@ class C1 extends C2 implements C3 {
test_VariableDeclarationStatement_RHS_missing_semicolon() async {
// VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement
addSource('/testB.dart', '''
addSource('/home/test/lib/b.dart', '''
lib B;
foo1() { }
void bar1() { }
class _B { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
import "testB.dart";
import 'b.dart';
foo2() { }
void bar2() { }
class Y {Y.c(); Y._d(); z() {}}