Clean up some tests to make conversion of contributor tests easier

Change-Id: I801970b4b88b883b2219badcefb7e1c84517d592
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297780
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Brian Wilkerson 2023-04-24 17:35:27 +00:00 committed by Commit Queue
parent 4b582c4581
commit 71d4e1478e
46 changed files with 574 additions and 584 deletions

View file

@ -81,10 +81,6 @@ class AbstractContextTest with ResourceProviderMixin {
String get workspaceRootPath => '/home';
void addSource(String path, String content) {
newFile(path, content);
}
Future<void> analyzeTestPackageFiles() async {
var analysisContext = contextFor(testPackageRootPath);
var files = analysisContext.contextRoot.analyzedFiles().toList();

View file

@ -30,16 +30,10 @@ class AbstractSingleUnitTest extends AbstractContextTest {
late FindNode findNode;
late FindElement findElement;
@override
void addSource(String path, String content) {
content = normalizeSource(content);
super.addSource(path, content);
}
void addTestSource(String code) {
code = normalizeSource(code);
testCode = code;
addSource(testFile, code);
newFile(testFile, code);
}
int findEnd(String search) {

View file

@ -46,17 +46,17 @@ class CombinatorContributorTest extends DartCompletionContributorTest {
Future<void> test_Combinator_hide() async {
// SimpleIdentifier HideCombinator ImportDirective
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
library libAB;
part "ab_part.dart";
class A { }
class B { }''');
addSource('$testPackageLibPath/ab_part.dart', '''
newFile('$testPackageLibPath/ab_part.dart', '''
part of libAB;
var T1;
PB F1() => new PB();
class PB { }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
class C { }
class D { }''');
addTestSource('''
@ -85,20 +85,20 @@ class CombinatorContributorTest extends DartCompletionContributorTest {
Future<void> test_Combinator_show() async {
// SimpleIdentifier HideCombinator ImportDirective
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
library libAB;
part "ab_part.dart";
class A { }
class B { }
class _AB''');
addSource('$testPackageLibPath/ab_part.dart', '''
newFile('$testPackageLibPath/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('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
class C { }
class D { }''');
addTestSource('''
@ -132,11 +132,11 @@ class CombinatorContributorTest extends DartCompletionContributorTest {
}
Future<void> test_Combinator_show_export_withShow() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
class A {}
class B {}
''');
addSource('$testPackageLibPath/b.dart', r'''
newFile('$testPackageLibPath/b.dart', r'''
export 'a.dart' show A;
''');
addTestSource(r'''
@ -154,10 +154,10 @@ import 'b.dart' show ^;
}
Future<void> test_Combinator_show_recursive() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {}
''');
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
export 'a.dart';
export 'b.dart';
class B {}

View file

@ -105,7 +105,7 @@ abstract class _BaseDartCompletionContributorTest extends AbstractContextTest {
expect(nextOffset, equals(-1), reason: 'too many ^');
content = content.substring(0, _completionOffset) +
content.substring(_completionOffset + 1);
addSource(testFile, content);
newFile(testFile, content);
}
/// A variant of [addTestSource] that can be invoked more than once,
@ -117,7 +117,7 @@ abstract class _BaseDartCompletionContributorTest extends AbstractContextTest {
expect(nextOffset, equals(-1), reason: 'too many ^');
content = content.substring(0, _completionOffset) +
content.substring(_completionOffset + 1);
addSource(testFile, content);
newFile(testFile, content);
driverFor(testFile).changeFile(testFile);
}
@ -647,7 +647,7 @@ abstract class _BaseDartCompletionContributorTest extends AbstractContextTest {
}
void resolveSource(String path, String content) {
addSource(path, content);
newFile(path, content);
}
@override

View file

@ -41,7 +41,7 @@ mixin ImportedReferenceContributorMixin on DartCompletionContributorTest {
class ImportedReferenceContributorTest extends DartCompletionContributorTest
with ImportedReferenceContributorMixin {
Future<void> test_Annotation_typeArguments() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class C {}
typedef T1 = void Function();
typedef T2 = List<int>;
@ -142,7 +142,7 @@ void f() {f^}''');
Future<void>
test_ArgumentList_InstanceCreationExpression_functionalArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@ -172,7 +172,7 @@ void f() {f^}''');
Future<void> test_ArgumentList_InstanceCreationExpression_typedefArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
typedef Funct();
class A { A(Funct f) { } }
@ -255,7 +255,7 @@ void f() {f^}''');
Future<void> test_ArgumentList_MethodInvocation_functionalArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@ -285,7 +285,7 @@ void f() {f^}''');
Future<void> test_ArgumentList_MethodInvocation_methodArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@ -314,7 +314,7 @@ void f() {f^}''');
Future<void> test_ArgumentList_namedParam() async {
// SimpleIdentifier NamedExpression ArgumentList MethodInvocation
// ExpressionStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }''');
addTestSource('''
@ -357,7 +357,7 @@ void f() {f^}''');
// value to the type it already has.
// SimpleIdentifier NamedType AsExpression IfStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
foo() { }
class A {} class B extends A {} class C extends B {}
class X {X.c(); X._d(); z() {}}''');
@ -384,7 +384,7 @@ void f() {f^}''');
// value to the type it already has.
// SimpleIdentifier NamedType AsExpression IfStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
foo() { }
class A {} class B implements A {} class C implements B {}
class X {X.c(); X._d(); z() {}}''');
@ -553,7 +553,7 @@ class B extends A {
Future<void> test_AwaitExpression_inherited() async {
// SimpleIdentifier AwaitExpression ExpressionStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib libB;
class A {
Future y() async { return 0; }
@ -607,21 +607,21 @@ class B extends A {
Future<void> test_Block() async {
// Block BlockFunctionBody MethodDeclaration
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('$testPackageLibPath/eef.dart', '''
newFile('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
addSource('$testPackageLibPath/g.dart', 'class G { }');
addSource('$testPackageLibPath/h.dart', '''
newFile('$testPackageLibPath/g.dart', 'class G { }');
newFile('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -710,21 +710,21 @@ class B extends A {
Future<void> test_Block_final() async {
// Block BlockFunctionBody MethodDeclaration
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('$testPackageLibPath/eef.dart', '''
newFile('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
addSource('$testPackageLibPath/g.dart', 'class G { }');
addSource('$testPackageLibPath/h.dart', '''
newFile('$testPackageLibPath/g.dart', 'class G { }');
newFile('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -823,21 +823,21 @@ class B extends A {
Future<void> test_Block_final_final() async {
// Block BlockFunctionBody MethodDeclaration
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('$testPackageLibPath/eef.dart', '''
newFile('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
addSource('$testPackageLibPath/g.dart', 'class G { }');
addSource('$testPackageLibPath/h.dart', '''
newFile('$testPackageLibPath/g.dart', 'class G { }');
newFile('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -924,21 +924,21 @@ class B extends A {
Future<void> test_Block_final_var() async {
// Block BlockFunctionBody MethodDeclaration
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('$testPackageLibPath/eef.dart', '''
newFile('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
addSource('$testPackageLibPath/g.dart', 'class G { }');
addSource('$testPackageLibPath/h.dart', '''
newFile('$testPackageLibPath/g.dart', 'class G { }');
newFile('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -1027,16 +1027,16 @@ class B extends A {
class A {int x;}
@deprecated D1() {int x;}
class _B { }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('$testPackageLibPath/eef.dart', '''
newFile('$testPackageLibPath/eef.dart', '''
class EE { }
class DF { }''');
addSource('$testPackageLibPath/g.dart', 'class G { }');
addSource('$testPackageLibPath/h.dart', '''
newFile('$testPackageLibPath/g.dart', 'class G { }');
newFile('$testPackageLibPath/h.dart', '''
class H { }
class D3 { }
int T3;
@ -1099,7 +1099,7 @@ class B extends A {
Future<void> test_Block_inherited_imported() async {
// Block BlockFunctionBody MethodDeclaration ClassDeclaration
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; }
class E extends F { var e1; e2() { } }
@ -1153,21 +1153,21 @@ class B extends A {
}
Future<void> test_Block_local_function() async {
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('$testPackageLibPath/eef.dart', '''
newFile('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
addSource('$testPackageLibPath/g.dart', 'class G { }');
addSource('$testPackageLibPath/h.dart', '''
newFile('$testPackageLibPath/g.dart', 'class G { }');
newFile('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -1205,21 +1205,21 @@ class B extends A {
Future<void> test_Block_partial_results() async {
// Block BlockFunctionBody MethodDeclaration
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B { }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('$testPackageLibPath/eef.dart', '''
newFile('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
addSource('$testPackageLibPath/g.dart', 'class G { }');
addSource('$testPackageLibPath/h.dart', '''
newFile('$testPackageLibPath/g.dart', 'class G { }');
newFile('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -1257,7 +1257,7 @@ class B extends A {
Future<void> test_CascadeExpression_selector1() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import 'b.dart';
@ -1282,7 +1282,7 @@ class B extends A {
Future<void> test_CascadeExpression_selector2() async {
// SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import 'b.dart';
@ -1305,7 +1305,7 @@ class B extends A {
Future<void> test_CascadeExpression_selector2_withTrailingReturn() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import 'b.dart';
@ -1400,7 +1400,7 @@ class B extends A {
Future<void> test_ClassDeclaration_body() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
const topLevel = 1;
class B { }''');
addTestSource('''
@ -1427,7 +1427,7 @@ class B extends A {
Future<void> test_ClassDeclaration_body_annotation() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B {
const B();
B.named();
@ -1459,7 +1459,7 @@ class B extends A {
Future<void> test_ClassDeclaration_body_final() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -1480,7 +1480,7 @@ class B extends A {
Future<void> test_ClassDeclaration_body_final_field() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -1501,7 +1501,7 @@ class B extends A {
Future<void> test_ClassDeclaration_body_final_field2() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as Soo;
@ -1522,7 +1522,7 @@ class B extends A {
Future<void> test_ClassDeclaration_body_final_final() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -1543,7 +1543,7 @@ class B extends A {
Future<void> test_ClassDeclaration_body_final_var() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -1564,17 +1564,17 @@ class B extends A {
Future<void> test_Combinator_hide() async {
// SimpleIdentifier HideCombinator ImportDirective
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
library libAB;
part 'partAB.dart';
class A { }
class B { }''');
addSource('/partAB.dart', '''
newFile('/partAB.dart', '''
part of libAB;
var T1;
PB F1() => new PB();
class PB { }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
class C { }
class D { }''');
addTestSource('''
@ -1588,19 +1588,19 @@ class B extends A {
Future<void> test_Combinator_show() async {
// SimpleIdentifier HideCombinator ImportDirective
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
library libAB;
part 'partAB.dart';
class A { }
class B { }''');
addSource('/partAB.dart', '''
newFile('/partAB.dart', '''
part of libAB;
var T1;
PB F1() => new PB();
typedef PB2 F2(int blat);
class Clz = Object with Object;
class PB { }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
class C { }
class D { }''');
addTestSource('''
@ -1614,7 +1614,7 @@ class B extends A {
Future<void> test_ConditionalExpression_elseExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -1663,7 +1663,7 @@ class B extends A {
Future<void> test_ConditionalExpression_partial_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -1712,7 +1712,7 @@ class B extends A {
Future<void> test_ConditionalExpression_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -1733,7 +1733,7 @@ class B extends A {
Future<void> test_ConstructorName_importedClass() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@ -1758,7 +1758,7 @@ class B extends A {
Future<void> test_ConstructorName_importedFactory() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@ -1859,7 +1859,7 @@ class B extends A {
}
Future<void> test_doc_class() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
library A;
/// My class.
/// Short description.
@ -1921,7 +1921,7 @@ int myFunc() {}
}
Future<void> test_enum() async {
addSource('$testPackageLibPath/a.dart', 'library A; enum E { one, two }');
newFile('$testPackageLibPath/a.dart', 'library A; enum E { one, two }');
addTestSource('import "a.dart"; void f() {^}');
await computeSuggestions();
assertSuggestEnum('E');
@ -1930,7 +1930,7 @@ int myFunc() {}
}
Future<void> test_enum_deprecated() async {
addSource('$testPackageLibPath/a.dart',
newFile('$testPackageLibPath/a.dart',
'library A; @deprecated enum E { one, two }');
addTestSource('import "a.dart"; void f() {^}');
await computeSuggestions();
@ -1942,7 +1942,7 @@ int myFunc() {}
}
Future<void> test_enum_filter() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
enum E { one, two }
enum F { three, four }
''');
@ -1998,7 +1998,7 @@ void f() {
Future<void> test_ExpressionStatement_name() async {
// ExpressionStatement Block BlockFunctionBody MethodDeclaration
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
B T1;
class B{}''');
addTestSource('''
@ -2058,7 +2058,7 @@ extension E on A { ^ }
Future<void> test_FieldDeclaration_name_typed() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
addSource('$testPackageLibPath/a.dart', 'class A { }');
newFile('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
class C {A ^}''');
@ -2070,7 +2070,7 @@ extension E on A { ^ }
Future<void> test_FieldDeclaration_name_var() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
addSource('$testPackageLibPath/a.dart', 'class A { }');
newFile('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
class C {var ^}''');
@ -2082,7 +2082,7 @@ extension E on A { ^ }
Future<void> test_FieldDeclaration_type() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
addSource('$testPackageLibPath/a.dart', 'class A { }');
newFile('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
class C {^ foo;) ''');
@ -2095,7 +2095,7 @@ extension E on A { ^ }
Future<void> test_FieldDeclaration_type_after_comment1() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
addSource('$testPackageLibPath/a.dart', 'class A { }');
newFile('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
class C {
@ -2111,7 +2111,7 @@ extension E on A { ^ }
Future<void> test_FieldDeclaration_type_after_comment2() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
addSource('$testPackageLibPath/a.dart', 'class A { }');
newFile('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
class C {
@ -2127,7 +2127,7 @@ extension E on A { ^ }
Future<void> test_FieldDeclaration_type_after_comment3() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
addSource('$testPackageLibPath/a.dart', 'class A { }');
newFile('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
class C {
@ -2143,7 +2143,7 @@ extension E on A { ^ }
Future<void> test_FieldDeclaration_type_without_semicolon() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
addSource('$testPackageLibPath/a.dart', 'class A { }');
newFile('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
class C {^ foo} ''');
@ -2639,7 +2639,7 @@ class B extends A {
}
Future<void> test_functionTypeAlias_genericTypeAlias() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
typedef F = void Function();
''');
addTestSource(r'''
@ -2655,7 +2655,7 @@ void f() {
}
Future<void> test_functionTypeAlias_old() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
typedef void F();
''');
addTestSource(r'''
@ -2747,7 +2747,7 @@ class B implements ^
}
Future<void> test_implicitCreation() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {
A.a1();
A.a2();
@ -2816,7 +2816,7 @@ void f() {
Future<void> test_IndexExpression2() async {
// SimpleIdentifier IndexExpression ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -2889,7 +2889,7 @@ void f() {new ^ String x = "hello";}''');
}
Future<void> test_InstanceCreationExpression_abstractClass() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
abstract class A {
A();
A.generative();
@ -2912,7 +2912,7 @@ void f() {
Future<void>
test_InstanceCreationExpression_abstractClass_implicitConstructor() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
abstract class A {}
''');
addTestSource('''
@ -2928,7 +2928,7 @@ void f() {
}
Future<void> test_InstanceCreationExpression_filter() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {}
class B extends A {}
class C implements A {}
@ -2951,7 +2951,7 @@ void f() {
Future<void> test_InstanceCreationExpression_imported() async {
// SimpleIdentifier NamedType ConstructorName InstanceCreationExpression
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {A(this.x) { } int x;}''');
@ -2994,7 +2994,7 @@ void f() {
Future<void> test_InstanceCreationExpression_unimported() async {
// SimpleIdentifier NamedType ConstructorName InstanceCreationExpression
addSource('$testPackageLibPath/ab.dart', 'class Clip { }');
newFile('$testPackageLibPath/ab.dart', 'class Clip { }');
addTestSource('class A {foo(){new C^}}');
await computeSuggestions();
@ -3018,7 +3018,7 @@ void f() {
Future<void> test_InterpolationExpression() async {
// SimpleIdentifier InterpolationExpression StringInterpolation
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -3052,7 +3052,7 @@ void f() {
Future<void> test_InterpolationExpression_block() async {
// SimpleIdentifier InterpolationExpression StringInterpolation
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -3127,7 +3127,7 @@ void f() {
Future<void> test_IsExpression() async {
// SimpleIdentifier NamedType IsExpression IfStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class X {X.c(); X._d(); z() {}}''');
@ -3202,7 +3202,7 @@ void f() {
// value to the type it already has.
// SimpleIdentifier NamedType IsExpression IfStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
foo() { }
class A {} class B extends A {} class C extends B {}
class X {X.c(); X._d(); z() {}}''');
@ -3229,7 +3229,7 @@ void f() {
// value to the type it already has.
// SimpleIdentifier NamedType IsExpression IfStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
foo() { }
class A {} class B implements A {} class C implements B {}
class X {X.c(); X._d(); z() {}}''');
@ -3311,7 +3311,7 @@ void f() {
Future<void> test_MapLiteralEntry() async {
// MapLiteralEntry MapLiteral VariableDeclaration
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -3349,7 +3349,7 @@ void f() {
Future<void> test_MapLiteralEntry1() async {
// MapLiteralEntry MapLiteral VariableDeclaration
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -3544,7 +3544,7 @@ class B {
Future<void> test_MethodDeclaration_body_static() async {
// Block BlockFunctionBody MethodDeclaration
addSource('$testPackageLibPath/c.dart', '''
newFile('$testPackageLibPath/c.dart', '''
class C {
c1() {}
var c2;
@ -3784,7 +3784,7 @@ class B {
}
Future<void> test_MethodTypeArgumentList() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {}
class B {}
''');
@ -3825,7 +3825,7 @@ void g() {
}
Future<void> test_mixin_ordering() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class B {}
class M1 {
void m() {}
@ -3859,7 +3859,7 @@ class C extends B with M1, M2 {
}
Future<void> test_no_parameters_field() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int x;
''');
addTestSource('''
@ -3889,7 +3889,7 @@ class B extends A {
}
Future<void> test_no_parameters_setter() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
set x(int value) {};
''');
addTestSource('''
@ -3912,12 +3912,12 @@ class B extends A {
Future<void> test_partFile_TypeName() async {
// SimpleIdentifier NamedType ConstructorName
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library libA;
import 'b.dart';
part "test.dart";
@ -3949,12 +3949,12 @@ class B extends A {
Future<void> test_partFile_TypeName2() async {
// SimpleIdentifier NamedType ConstructorName
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib libB;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
part of libA;
class B { }''');
addTestSource('''
@ -3984,7 +3984,7 @@ class B extends A {
Future<void> test_PrefixedIdentifier_class_const() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
class I {
static const scI = 'boo';
@ -4031,7 +4031,7 @@ class B extends A {
Future<void> test_PrefixedIdentifier_class_imported() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
class I {X get f => new A();get _g => new A();}
class A implements I {
@ -4110,7 +4110,7 @@ class B extends A {
Future<void> test_PrefixedIdentifier_library() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@ -4137,7 +4137,7 @@ class B extends A {
Future<void> test_PrefixedIdentifier_library_typesOnly() async {
// SimpleIdentifier PrefixedIdentifier NamedType
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@ -4164,7 +4164,7 @@ class B extends A {
Future<void> test_PrefixedIdentifier_library_typesOnly2() async {
// SimpleIdentifier PrefixedIdentifier NamedType
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@ -4191,7 +4191,7 @@ class B extends A {
Future<void> test_PrefixedIdentifier_parameter() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
class _W {M y; var _z;}
class X extends _W {}
@ -4210,7 +4210,7 @@ class B extends A {
Future<void> test_PrefixedIdentifier_prefix() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {static int bar = 10;}
_B() {}''');
addTestSource('''
@ -4356,7 +4356,7 @@ class B extends A {
Future<void> test_PropertyAccess_noTarget() async {
// SimpleIdentifier PropertyAccess ExpressionStatement
addSource('$testPackageLibPath/ab.dart', 'class Foo { }');
newFile('$testPackageLibPath/ab.dart', 'class Foo { }');
addTestSource('class C {foo(){.^}}');
await computeSuggestions();
@ -4365,7 +4365,7 @@ class B extends A {
Future<void> test_PropertyAccess_noTarget2() async {
// SimpleIdentifier PropertyAccess ExpressionStatement
addSource('$testPackageLibPath/ab.dart', 'class Foo { }');
newFile('$testPackageLibPath/ab.dart', 'class Foo { }');
addTestSource('void f() {.^}');
await computeSuggestions();
@ -4637,7 +4637,7 @@ class B extends A {
Future<void> test_TopLevelVariableDeclaration_type() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// TopLevelVariableDeclaration
addSource('$testPackageLibPath/a.dart', 'class A { }');
newFile('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
^ foo; ''');
@ -4650,7 +4650,7 @@ class B extends A {
Future<void> test_TopLevelVariableDeclaration_type_after_comment1() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// TopLevelVariableDeclaration
addSource('$testPackageLibPath/a.dart', 'class A { }');
newFile('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
// comment
@ -4664,7 +4664,7 @@ class B extends A {
Future<void> test_TopLevelVariableDeclaration_type_after_comment2() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// TopLevelVariableDeclaration
addSource('$testPackageLibPath/a.dart', 'class A { }');
newFile('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
/* comment */
@ -4678,7 +4678,7 @@ class B extends A {
Future<void> test_TopLevelVariableDeclaration_type_after_comment3() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// TopLevelVariableDeclaration
addSource('$testPackageLibPath/a.dart', 'class A { }');
newFile('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
/// some dartdoc
@ -4692,7 +4692,7 @@ class B extends A {
Future<void> test_TopLevelVariableDeclaration_type_without_semicolon() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// TopLevelVariableDeclaration
addSource('$testPackageLibPath/a.dart', 'class A { }');
newFile('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import 'a.dart';
^ foo ''');
@ -4796,7 +4796,7 @@ typedef void F(^);
Future<void> test_TypeArgumentList2() async {
// NamedType TypeArgumentList NamedType
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class C1 {int x;}
F1() => 0;
typedef String T1(int blat);''');
@ -4856,7 +4856,7 @@ List<^> x;
Future<void> test_VariableDeclaration_name() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement Block
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class _B { }
@ -4883,7 +4883,7 @@ List<^> x;
Future<void> test_VariableDeclarationStatement_RHS() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class _B { }

View file

@ -34,7 +34,7 @@ class LibraryMemberContributorTest extends DartCompletionContributorTest {
Future<void> test_extension() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
extension MyExt on int {}
''');
addTestSource('''
@ -172,7 +172,7 @@ class C { }
Future<void> test_PrefixedIdentifier_library() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@ -198,11 +198,11 @@ void f() {b.^}
}
Future<void> test_PrefixedIdentifier_library_export_withShow() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
class A {}
class B {}
''');
addSource('$testPackageLibPath/b.dart', r'''
newFile('$testPackageLibPath/b.dart', r'''
export 'a.dart' show A;
''');
addTestSource(r'''
@ -217,7 +217,7 @@ void f() {
}
Future<void> test_PrefixedIdentifier_library_import_withShow() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
class A {}
class B {}
''');

View file

@ -50,21 +50,21 @@ class LibraryPrefixContributorTest extends DartCompletionContributorTest {
Future<void> test_Block() async {
// Block BlockFunctionBody MethodDeclaration
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('$testPackageLibPath/eef.dart', '''
newFile('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
addSource('$testPackageLibPath/g.dart', 'class G { }');
addSource('$testPackageLibPath/h.dart', '''
newFile('$testPackageLibPath/g.dart', 'class G { }');
newFile('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -97,21 +97,21 @@ class Z { }''');
Future<void> test_Block_final_final() async {
// Block BlockFunctionBody MethodDeclaration
addSource('/testAB.dart', '''
newFile('/testAB.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('/testCD.dart', '''
newFile('/testCD.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('/testEEF.dart', '''
newFile('/testEEF.dart', '''
class EE { }
class F { }''');
addSource('/testG.dart', 'class G { }');
addSource('/testH.dart', '''
newFile('/testG.dart', 'class G { }');
newFile('/testH.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -144,21 +144,21 @@ class Z { }''');
Future<void> test_Block_final_var() async {
// Block BlockFunctionBody MethodDeclaration
addSource('/testAB.dart', '''
newFile('/testAB.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('/testCD.dart', '''
newFile('/testCD.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('/testEEF.dart', '''
newFile('/testEEF.dart', '''
class EE { }
class F { }''');
addSource('/testG.dart', 'class G { }');
addSource('/testH.dart', '''
newFile('/testG.dart', 'class G { }');
newFile('/testH.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -191,7 +191,7 @@ class Z { }''');
Future<void> test_ClassDeclaration_body() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -206,7 +206,7 @@ A T;''');
Future<void> test_ClassDeclaration_body_final() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -221,7 +221,7 @@ A T;''');
Future<void> test_ClassDeclaration_body_final_field() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -236,7 +236,7 @@ A T;''');
Future<void> test_ClassDeclaration_body_final_field2() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as Soo;
@ -251,7 +251,7 @@ A Sew;''');
Future<void> test_ClassDeclaration_body_final_final() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -266,7 +266,7 @@ A T;''');
Future<void> test_ClassDeclaration_body_final_var() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -280,7 +280,7 @@ A T;''');
}
Future<void> test_InstanceCreationExpression() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/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}) { } }''');
@ -299,11 +299,11 @@ void f() {new ^ String x = "hello";}''');
}
Future<void> test_InstanceCreationExpression_inPart() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/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('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
library testB;
import "a.dart" as t;
import "dart:math" as math;
@ -318,11 +318,11 @@ void f() {new ^ String x = "hello";}''');
}
Future<void> test_InstanceCreationExpression_inPart_detached() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/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('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
library testB;
import "a.dart" as t;
import "dart:math" as math;

View file

@ -125,7 +125,7 @@ class A {
Future<void> test_ArgumentList() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
@ -150,7 +150,7 @@ void f() {expect(^)}''');
Future<void> test_ArgumentList_imported_function() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(arg) { }
@ -177,7 +177,7 @@ void f() {expect(^)}''');
Future<void>
test_ArgumentList_InstanceCreationExpression_functionalArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@ -206,7 +206,7 @@ void f() {new A(^)}''');
Future<void> test_ArgumentList_InstanceCreationExpression_typedefArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
typedef Funct();
class A { A(Funct f) { } }
@ -236,7 +236,7 @@ void f() {new A(^)}''');
Future<void> test_ArgumentList_local_function() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
@ -262,7 +262,7 @@ void f() {expect(^)}''');
Future<void> test_ArgumentList_local_method() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
@ -288,7 +288,7 @@ String bar() => true;''');
Future<void> test_ArgumentList_MethodInvocation_functionalArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@ -319,7 +319,7 @@ void f() {boo(){} bar(^);}''');
Future<void> test_ArgumentList_MethodInvocation_functionalArg2() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@ -355,7 +355,7 @@ void f() {boo(){} bar(inc: ^);}''');
Future<void> test_ArgumentList_MethodInvocation_methodArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@ -380,7 +380,7 @@ void f() {new B().bar(^);}''');
}
Future<void> test_ArgumentList_namedFieldParam_tear_off() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
typedef void VoidCallback();
class Button {
@ -411,7 +411,7 @@ class PageState {
Future<void> test_ArgumentList_namedParam() async {
// SimpleIdentifier NamedExpression ArgumentList MethodInvocation
// ExpressionStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }''');
addTestSource('''
@ -457,7 +457,7 @@ void f() {expect(foo: ^)}''');
}
Future<void> test_ArgumentList_namedParam_tear_off() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
typedef void VoidCallback();
class Button {
@ -485,7 +485,7 @@ class PageState {
}
Future<void> test_ArgumentList_namedParam_tear_off_1() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
typedef void VoidCallback();
class Button {
@ -513,7 +513,7 @@ class PageState {
}
Future<void> test_ArgumentList_namedParam_tear_off_2() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
typedef void VoidCallback();
class Button {
@ -817,21 +817,21 @@ class B extends A {
Future<void> test_Block() async {
// Block BlockFunctionBody MethodDeclaration
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('$testPackageLibPath/eef.dart', '''
newFile('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
addSource('$testPackageLibPath/g.dart', 'class G { }');
addSource('$testPackageLibPath/h.dart', '''
newFile('$testPackageLibPath/g.dart', 'class G { }');
newFile('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -910,21 +910,21 @@ class Z { }''');
Future<void> test_Block_final() async {
// Block BlockFunctionBody MethodDeclaration
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('$testPackageLibPath/eef.dart', '''
newFile('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
addSource('$testPackageLibPath/g.dart', 'class G { }');
addSource('$testPackageLibPath/h.dart', '''
newFile('$testPackageLibPath/g.dart', 'class G { }');
newFile('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -1023,21 +1023,21 @@ class Z { }''');
Future<void> test_Block_final_final() async {
// Block BlockFunctionBody MethodDeclaration
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('$testPackageLibPath/eef.dart', '''
newFile('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
addSource('$testPackageLibPath/g.dart', 'class G { }');
addSource('$testPackageLibPath/h.dart', '''
newFile('$testPackageLibPath/g.dart', 'class G { }');
newFile('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -1122,21 +1122,21 @@ class Z { }''');
Future<void> test_Block_final_var() async {
// Block BlockFunctionBody MethodDeclaration
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('$testPackageLibPath/eef.dart', '''
newFile('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
addSource('$testPackageLibPath/g.dart', 'class G { }');
addSource('$testPackageLibPath/h.dart', '''
newFile('$testPackageLibPath/g.dart', 'class G { }');
newFile('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -1220,21 +1220,21 @@ class Z { }''');
}
Future<void> test_Block_identifier_partial() async {
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B { }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('$testPackageLibPath/eef.dart', '''
newFile('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
addSource('$testPackageLibPath/g.dart', 'class G { }');
addSource('$testPackageLibPath/h.dart', '''
newFile('$testPackageLibPath/g.dart', 'class G { }');
newFile('$testPackageLibPath/h.dart', '''
class H { }
class D3 { }
int T3;
@ -1453,21 +1453,21 @@ class A extends E implements I with M {a() {^}}''');
}
Future<void> test_Block_local_function() async {
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('$testPackageLibPath/eef.dart', '''
newFile('$testPackageLibPath/eef.dart', '''
class EE { }
class F { }''');
addSource('$testPackageLibPath/g.dart', 'class G { }');
addSource('$testPackageLibPath/h.dart', '''
newFile('$testPackageLibPath/g.dart', 'class G { }');
newFile('$testPackageLibPath/h.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -1531,7 +1531,7 @@ void f() {
Future<void> test_CascadeExpression_selector1() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart";
@ -1556,7 +1556,7 @@ void f() {A a; a.^.z}''');
Future<void> test_CascadeExpression_selector2() async {
// SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart";
@ -1579,7 +1579,7 @@ void f() {A a; a..^z}''');
Future<void> test_CascadeExpression_selector2_withTrailingReturn() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart";
@ -1685,7 +1685,7 @@ class E {}
Future<void> test_ClassDeclaration_body() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -1714,7 +1714,7 @@ A T;''');
Future<void> test_ClassDeclaration_body_final() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -1735,7 +1735,7 @@ A T;''');
Future<void> test_ClassDeclaration_body_final_field() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -1756,7 +1756,7 @@ A T;''');
Future<void> test_ClassDeclaration_body_final_field2() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as Soo;
@ -1777,7 +1777,7 @@ A Sew;''');
Future<void> test_ClassDeclaration_body_final_final() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -1798,7 +1798,7 @@ A T;''');
Future<void> test_ClassDeclaration_body_final_var() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -1844,17 +1844,17 @@ class Abcd { }
Future<void> test_Combinator_hide() async {
// SimpleIdentifier HideCombinator ImportDirective
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
library libAB;
part 'partAB.dart';
class A { }
class B { }''');
addSource('/partAB.dart', '''
newFile('/partAB.dart', '''
part of libAB;
var T1;
PB F1() => new PB();
class PB { }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
class C { }
class D { }''');
addTestSource('''
@ -1868,19 +1868,19 @@ class X {}''');
Future<void> test_Combinator_show() async {
// SimpleIdentifier HideCombinator ImportDirective
addSource('$testPackageLibPath/ab.dart', '''
newFile('$testPackageLibPath/ab.dart', '''
library libAB;
part 'partAB.dart';
class A { }
class B { }''');
addSource('/partAB.dart', '''
newFile('/partAB.dart', '''
part of libAB;
var T1;
PB F1() => new PB();
typedef PB2 F2(int blat);
class Clz = Object with Object;
class PB { }''');
addSource('$testPackageLibPath/cd.dart', '''
newFile('$testPackageLibPath/cd.dart', '''
class C { }
class D { }''');
addTestSource('''
@ -1894,7 +1894,7 @@ class X {}''');
Future<void> test_ConditionalExpression_elseExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -1914,7 +1914,7 @@ class C {foo(){var f; {var x;} return a ? T1 : T^}}''');
Future<void> test_ConditionalExpression_elseExpression_empty() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -1940,7 +1940,7 @@ class C {foo(){var f; {var x;} return a ? T1 : ^}}''');
Future<void> test_ConditionalExpression_partial_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -1960,7 +1960,7 @@ class C {foo(){var f; {var x;} return a ? T^}}''');
Future<void> test_ConditionalExpression_partial_thenExpression_empty() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -1986,7 +1986,7 @@ class C {foo(){var f; {var x;} return a ? ^}}''');
Future<void> test_ConditionalExpression_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -2073,7 +2073,7 @@ class A {
Future<void> test_ConstructorName_importedClass() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@ -2098,7 +2098,7 @@ void f() {new X.^}''');
Future<void> test_ConstructorName_importedFactory() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@ -2601,7 +2601,7 @@ class B<U> {}
Future<void> test_ExpressionStatement_identifier() async {
// SimpleIdentifier ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
_B F1() { }
class A {int x;}
class _B { }''');
@ -2629,7 +2629,7 @@ class C {foo(){^} void bar() {}}''');
Future<void> test_ExpressionStatement_name() async {
// ExpressionStatement Block BlockFunctionBody MethodDeclaration
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
B T1;
class B{}''');
addTestSource('''
@ -2699,7 +2699,7 @@ extension E on A { ^ }
Future<void> test_extensionDeclaration_notInBody() async {
// ExtensionDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -2752,7 +2752,7 @@ extension on String {
Future<void> test_FieldDeclaration_name_typed() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
addSource('$testPackageLibPath/a.dart', 'class A { }');
newFile('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import "a.dart";
class C {A ^}''');
@ -2764,7 +2764,7 @@ extension on String {
Future<void> test_FieldDeclaration_name_var() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
addSource('$testPackageLibPath/a.dart', 'class A { }');
newFile('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import "a.dart";
class C {var ^}''');
@ -3225,7 +3225,7 @@ void f<T>(^) {}
Future<void> test_FunctionDeclaration_returnType_afterComment() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -3256,7 +3256,7 @@ class C2 { }
Future<void> test_FunctionDeclaration_returnType_afterComment2() async {
// FunctionDeclaration ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -3287,7 +3287,7 @@ class C2 { }
Future<void> test_FunctionDeclaration_returnType_afterComment3() async {
// FunctionDeclaration ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -3553,7 +3553,7 @@ void f(aaa, bbb) {}''');
Future<void> test_IndexExpression() async {
// ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -3579,7 +3579,7 @@ class C {foo(){var f; {var x;} f[^]}}''');
Future<void> test_IndexExpression2() async {
// SimpleIdentifier IndexExpression ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -3800,7 +3800,7 @@ void f() {
Future<void> test_InstanceCreationExpression_imported() async {
// SimpleIdentifier NamedType ConstructorName InstanceCreationExpression
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {A(this.x) { } int x;}''');
@ -3860,7 +3860,7 @@ void f() {
Future<void> test_InstanceCreationExpression_unimported() async {
// SimpleIdentifier NamedType ConstructorName InstanceCreationExpression
addSource('/testAB.dart', 'class Foo { }');
newFile('/testAB.dart', 'class Foo { }');
addTestSource('class C {foo(){new F^}}');
await computeSuggestions();
@ -3902,7 +3902,7 @@ void f() {
Future<void> test_InterpolationExpression_block() async {
// SimpleIdentifier InterpolationExpression StringInterpolation
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -3975,7 +3975,7 @@ void f() {String name; print("hello \${^}");}''');
Future<void> test_IsExpression() async {
// SimpleIdentifier NamedType IsExpression IfStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class X {X.c(); X._d(); z() {}}''');
@ -4098,7 +4098,7 @@ void f(){var a; if (a is Obj^)}''');
}
Future<void> test_keyword() async {
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
int newT1;
int T1;
@ -4251,7 +4251,7 @@ void f() {
Future<void> test_MapLiteralEntry() async {
// MapLiteralEntry MapLiteral VariableDeclaration
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -4281,7 +4281,7 @@ foo = {^''');
Future<void> test_MapLiteralEntry1() async {
// MapLiteralEntry MapLiteral VariableDeclaration
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -4303,7 +4303,7 @@ foo = {T^''');
Future<void> test_MapLiteralEntry2() async {
// SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -4644,7 +4644,7 @@ class Z {}
Future<void> test_MethodDeclaration_body_static() async {
// Block BlockFunctionBody MethodDeclaration
addSource('$testPackageLibPath/c.dart', '''
newFile('$testPackageLibPath/c.dart', '''
class C {
c1() {}
var c2;
@ -4821,7 +4821,7 @@ class Z {}
Future<void> test_MethodDeclaration_returnType() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -4851,7 +4851,7 @@ class C2 {^ zoo(z) { } String name; }''');
Future<void> test_MethodDeclaration_returnType_afterComment() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -4881,7 +4881,7 @@ class C2 {/* */ ^ zoo(z) { } String name; }''');
Future<void> test_MethodDeclaration_returnType_afterComment2() async {
// MethodDeclaration ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -4911,7 +4911,7 @@ class C2 {/** */ ^ zoo(z) { } String name; }''');
Future<void> test_MethodDeclaration_returnType_afterComment3() async {
// MethodDeclaration ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -5068,7 +5068,7 @@ class C extends B with M1, M2 {
Future<void> test_MixinDeclaration_body() async {
// MixinDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -5312,7 +5312,7 @@ foo(int bar) {
Future<void> test_PrefixedIdentifier_class_const() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
class I {
static const scI = 'boo';
@ -5359,7 +5359,7 @@ void f() {A.^}''');
Future<void> test_PrefixedIdentifier_class_imported() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
class I {X get f => new A();get _g => new A();}
class A implements I {
@ -5438,7 +5438,7 @@ class X{}''');
Future<void> test_PrefixedIdentifier_library() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@ -5465,7 +5465,7 @@ void f() {b.^}''');
Future<void> test_PrefixedIdentifier_library_typesOnly() async {
// SimpleIdentifier PrefixedIdentifier NamedType
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@ -5492,7 +5492,7 @@ foo(b.^ f) {}''');
Future<void> test_PrefixedIdentifier_library_typesOnly2() async {
// SimpleIdentifier PrefixedIdentifier NamedType
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@ -5519,7 +5519,7 @@ foo(b.^) {}''');
Future<void> test_PrefixedIdentifier_parameter() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
class _W {M y; var _z;}
class X extends _W {}
@ -5538,7 +5538,7 @@ foo(X x) {x.^}''');
Future<void> test_PrefixedIdentifier_prefix() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {static int bar = 10;}
_B() {}''');
addTestSource('''
@ -5702,7 +5702,7 @@ class X {foo(){A^.bar}}''');
Future<void> test_PropertyAccess_noTarget() async {
// SimpleIdentifier PropertyAccess ExpressionStatement
addSource('$testPackageLibPath/ab.dart', 'class Foo { }');
newFile('$testPackageLibPath/ab.dart', 'class Foo { }');
addTestSource('class C {foo(){.^}}');
await computeSuggestions();
@ -5711,7 +5711,7 @@ class X {foo(){A^.bar}}''');
Future<void> test_PropertyAccess_noTarget2() async {
// SimpleIdentifier PropertyAccess ExpressionStatement
addSource('$testPackageLibPath/ab.dart', 'class Foo { }');
newFile('$testPackageLibPath/ab.dart', 'class Foo { }');
addTestSource('void f() {.^}');
await computeSuggestions();
@ -6183,7 +6183,7 @@ void f() {
Future<void> test_TypeArgumentList() async {
// SimpleIdentifier BinaryExpression ExpressionStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class C1 {int x;}
F1() => 0;
typedef String T1(int blat);''');
@ -6210,7 +6210,7 @@ void f() { C<^> c; }''');
Future<void> test_TypeArgumentList2() async {
// NamedType TypeArgumentList NamedType
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class C1 {int x;}
F1() => 0;
typedef String T1(int blat);''');
@ -6274,7 +6274,7 @@ class A<T> {
Future<void> test_VariableDeclaration_name() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement Block
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class _B { }
@ -6301,7 +6301,7 @@ void f() {var ^}''');
Future<void> test_VariableDeclarationStatement_RHS() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class _B { }
@ -6326,7 +6326,7 @@ class C {bar(){var f; {var x;} var e = ^}}''');
Future<void> test_VariableDeclarationStatement_RHS_missing_semicolon() async {
// VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
foo1() { }
void bar1() { }

View file

@ -297,7 +297,7 @@ void f() {
Future<void> test_ConstructorName_importedClass() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@ -325,7 +325,7 @@ void f() {
Future<void> test_ConstructorName_importedClass_unresolved() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@ -354,7 +354,7 @@ void f() {
Future<void> test_ConstructorName_importedFactory() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@ -455,7 +455,7 @@ void f() {
Future<void>
test_importPrefix_className_typeArguments_period_nothing_functionTypeContext_matchingReturnType() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A<T> {
A.named();
A.new();

View file

@ -33,7 +33,7 @@ class StaticMemberContributorTest extends DartCompletionContributorTest {
}
Future<void> test_class_static_notPrivate() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {
static int _f;
static String get _g => '';
@ -143,7 +143,7 @@ void f() {E.^}
}
Future<void> test_extension_static_notPrivate() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
extension E {
static int _f;
static String get _g => '';
@ -165,7 +165,7 @@ void f() {
}
Future<void> test_implicitCreation() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {
A.foo();
A.bar();
@ -186,7 +186,7 @@ void f() {
Future<void>
test_implicitCreation_functionContextType_matchingReturnType() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {
A.foo();
A.bar();
@ -207,7 +207,7 @@ void f() {
Future<void>
test_implicitCreation_functionContextType_notMatchingReturnType() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {
A.foo();
A.bar();
@ -371,7 +371,7 @@ void f() {async.Future.^.w()}''');
Future<void> test_PrefixedIdentifier_class_const() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
class I {
static const scI = 'boo';
@ -415,7 +415,7 @@ void f() {async.Future.^.w()}''');
}
Future<void> test_simpleIdentifier_typeAlias_interfaceType_class() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {
static int _privateField = 0;
static int get _privateGetter => 0;
@ -457,7 +457,7 @@ void f() {
}
Future<void> test_simpleIdentifier_typeAlias_interfaceType_enum() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
enum E {
aaa,
_bbb,

View file

@ -119,7 +119,7 @@ void f() {new A().f^}''');
Future<void> test_ArgumentList() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
@ -143,7 +143,7 @@ void f() {new A().f^}''');
Future<void> test_ArgumentList_imported_function() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
expect(arg) { }
@ -169,7 +169,7 @@ void f() {new A().f^}''');
Future<void>
test_ArgumentList_InstanceCreationExpression_functionalArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@ -196,7 +196,7 @@ void f() {new A().f^}''');
Future<void> test_ArgumentList_InstanceCreationExpression_typedefArg() async {
// ArgumentList InstanceCreationExpression ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
typedef Funct();
class A { A(Funct f) { } }
@ -224,7 +224,7 @@ void f() {new A().f^}''');
Future<void> test_ArgumentList_local_function() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
@ -249,7 +249,7 @@ void f() {new A().f^}''');
Future<void> test_ArgumentList_local_method() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }
void baz() { }''');
@ -274,7 +274,7 @@ void f() {new A().f^}''');
Future<void> test_ArgumentList_MethodInvocation_functionalArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@ -301,7 +301,7 @@ void f() {new A().f^}''');
Future<void> test_ArgumentList_MethodInvocation_methodArg() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
class A { A(f()) { } }
bool hasLength(int expected) { }
@ -327,7 +327,7 @@ void f() {new A().f^}''');
Future<void> test_ArgumentList_namedParam() async {
// SimpleIdentifier NamedExpression ArgumentList MethodInvocation
// ExpressionStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library A;
bool hasLength(int expected) { }''');
addTestSource('''
@ -504,21 +504,21 @@ void f() {new A().f^}''');
Future<void> test_Block() async {
// Block BlockFunctionBody MethodDeclaration
addSource('/testAB.dart', '''
newFile('/testAB.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('/testCD.dart', '''
newFile('/testCD.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('/testEEF.dart', '''
newFile('/testEEF.dart', '''
class EE { }
class F { }''');
addSource('/testG.dart', 'class G { }');
addSource('/testH.dart', '''
newFile('/testG.dart', 'class G { }');
newFile('/testH.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -596,21 +596,21 @@ void f() {new A().f^}''');
Future<void> test_Block_final() async {
// Block BlockFunctionBody MethodDeclaration
addSource('/testAB.dart', '''
newFile('/testAB.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('/testCD.dart', '''
newFile('/testCD.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('/testEEF.dart', '''
newFile('/testEEF.dart', '''
class EE { }
class F { }''');
addSource('/testG.dart', 'class G { }');
addSource('/testH.dart', '''
newFile('/testG.dart', 'class G { }');
newFile('/testH.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -708,21 +708,21 @@ void f() {new A().f^}''');
Future<void> test_Block_final_final() async {
// Block BlockFunctionBody MethodDeclaration
addSource('/testAB.dart', '''
newFile('/testAB.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('/testCD.dart', '''
newFile('/testCD.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('/testEEF.dart', '''
newFile('/testEEF.dart', '''
class EE { }
class F { }''');
addSource('/testG.dart', 'class G { }');
addSource('/testH.dart', '''
newFile('/testG.dart', 'class G { }');
newFile('/testH.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -806,21 +806,21 @@ void f() {new A().f^}''');
Future<void> test_Block_final_var() async {
// Block BlockFunctionBody MethodDeclaration
addSource('/testAB.dart', '''
newFile('/testAB.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('/testCD.dart', '''
newFile('/testCD.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('/testEEF.dart', '''
newFile('/testEEF.dart', '''
class EE { }
class F { }''');
addSource('/testG.dart', 'class G { }');
addSource('/testH.dart', '''
newFile('/testG.dart', 'class G { }');
newFile('/testH.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -903,21 +903,21 @@ void f() {new A().f^}''');
}
Future<void> test_Block_identifier_partial() async {
addSource('/testAB.dart', '''
newFile('/testAB.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B { }''');
addSource('/testCD.dart', '''
newFile('/testCD.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('/testEEF.dart', '''
newFile('/testEEF.dart', '''
class EE { }
class F { }''');
addSource('/testG.dart', 'class G { }');
addSource('/testH.dart', '''
newFile('/testG.dart', 'class G { }');
newFile('/testH.dart', '''
class H { }
class D3 { }
int T3;
@ -982,7 +982,7 @@ void f() {new A().f^}''');
Future<void> test_Block_inherited_imported() async {
// Block BlockFunctionBody MethodDeclaration ClassDeclaration
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; }
class E extends F { var e1; e2() { } }
@ -1035,21 +1035,21 @@ void f() {new A().f^}''');
}
Future<void> test_Block_local_function() async {
addSource('/testAB.dart', '''
newFile('/testAB.dart', '''
export "dart:math" hide max;
class A {int x;}
@deprecated D1() {int x;}
class _B {boo() { partBoo() {}} }''');
addSource('/testCD.dart', '''
newFile('/testCD.dart', '''
String T1;
var _T2;
class C { }
class D { }''');
addSource('/testEEF.dart', '''
newFile('/testEEF.dart', '''
class EE { }
class F { }''');
addSource('/testG.dart', 'class G { }');
addSource('/testH.dart', '''
newFile('/testG.dart', 'class G { }');
newFile('/testH.dart', '''
class H { }
int T3;
var _T4;'''); // not imported
@ -1098,7 +1098,7 @@ void f() {new A().f^}''');
Future<void> test_CascadeExpression_method1() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart";
@ -1122,7 +1122,7 @@ void f() {new A().f^}''');
Future<void> test_CascadeExpression_selector1() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart";
@ -1146,7 +1146,7 @@ void f() {new A().f^}''');
Future<void> test_CascadeExpression_selector2() async {
// SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart";
@ -1168,7 +1168,7 @@ void f() {new A().f^}''');
Future<void> test_CascadeExpression_selector2_withTrailingReturn() async {
// PropertyAccess CascadeExpression ExpressionStatement Block
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart";
@ -1257,7 +1257,7 @@ void f() {new A().f^}''');
Future<void> test_ClassDeclaration_body() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -1276,7 +1276,7 @@ void f() {new A().f^}''');
Future<void> test_ClassDeclaration_body_final() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -1295,7 +1295,7 @@ void f() {new A().f^}''');
Future<void> test_ClassDeclaration_body_final_field() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -1314,7 +1314,7 @@ void f() {new A().f^}''');
Future<void> test_ClassDeclaration_body_final_field2() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as Soo;
@ -1333,7 +1333,7 @@ void f() {new A().f^}''');
Future<void> test_ClassDeclaration_body_final_final() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -1352,7 +1352,7 @@ void f() {new A().f^}''');
Future<void> test_ClassDeclaration_body_final_var() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
class B { }''');
addTestSource('''
import "b.dart" as x;
@ -1371,17 +1371,17 @@ void f() {new A().f^}''');
Future<void> test_Combinator_hide() async {
// SimpleIdentifier HideCombinator ImportDirective
addSource('/testAB.dart', '''
newFile('/testAB.dart', '''
library libAB;
part 'partAB.dart';
class A { }
class B { }''');
addSource('/partAB.dart', '''
newFile('/partAB.dart', '''
part of libAB;
var T1;
PB F1() => PB();
class PB { }''');
addSource('/testCD.dart', '''
newFile('/testCD.dart', '''
class C { }
class D { }''');
addTestSource('''
@ -1394,19 +1394,19 @@ void f() {new A().f^}''');
Future<void> test_Combinator_show() async {
// SimpleIdentifier HideCombinator ImportDirective
addSource('/testAB.dart', '''
newFile('/testAB.dart', '''
library libAB;
part 'partAB.dart';
class A { }
class B { }''');
addSource('/partAB.dart', '''
newFile('/partAB.dart', '''
part of libAB;
var T1;
PB F1() => PB();
typedef PB2 F2(int blat);
class Clz = Object with Object;
class PB { }''');
addSource('/testCD.dart', '''
newFile('/testCD.dart', '''
class C { }
class D { }''');
addTestSource('''
@ -1419,7 +1419,7 @@ void f() {new A().f^}''');
Future<void> test_ConditionalExpression_elseExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -1438,7 +1438,7 @@ void f() {new A().f^}''');
Future<void> test_ConditionalExpression_elseExpression_empty() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -1463,7 +1463,7 @@ void f() {new A().f^}''');
Future<void> test_ConditionalExpression_partial_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -1482,7 +1482,7 @@ void f() {new A().f^}''');
Future<void> test_ConditionalExpression_partial_thenExpression_empty() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -1507,7 +1507,7 @@ void f() {new A().f^}''');
Future<void> test_ConditionalExpression_thenExpression() async {
// SimpleIdentifier ConditionalExpression ReturnStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -1527,7 +1527,7 @@ void f() {new A().f^}''');
Future<void> test_ConstructorName_importedClass() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@ -1551,7 +1551,7 @@ void f() {new A().f^}''');
Future<void> test_ConstructorName_importedFactory() async {
// SimpleIdentifier PrefixedIdentifier NamedType ConstructorName
// InstanceCreationExpression
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
@ -1717,7 +1717,7 @@ void f() {new A().f^}''');
Future<void> test_ExpressionStatement_identifier() async {
// SimpleIdentifier ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
_B F1() { }
class A {int x;}
class _B { }''');
@ -1743,7 +1743,7 @@ void f() {new A().f^}''');
Future<void> test_ExpressionStatement_name() async {
// ExpressionStatement Block BlockFunctionBody MethodDeclaration
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
B T1;
class B{}''');
addTestSource('''
@ -1770,7 +1770,7 @@ void f() {
Future<void> test_FieldDeclaration_name_typed() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
addSource('$testPackageLibPath/a.dart', 'class A { }');
newFile('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import "a.dart";
class C {A ^}''');
@ -1781,7 +1781,7 @@ void f() {
Future<void> test_FieldDeclaration_name_var() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// FieldDeclaration
addSource('$testPackageLibPath/a.dart', 'class A { }');
newFile('$testPackageLibPath/a.dart', 'class A { }');
addTestSource('''
import "a.dart";
class C {var ^}''');
@ -1933,7 +1933,7 @@ void f() {
Future<void> test_FunctionDeclaration_returnType_afterComment() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -1962,7 +1962,7 @@ void f() {
Future<void> test_FunctionDeclaration_returnType_afterComment2() async {
// FunctionDeclaration ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -1991,7 +1991,7 @@ void f() {
Future<void> test_FunctionDeclaration_returnType_afterComment3() async {
// FunctionDeclaration ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -2185,7 +2185,7 @@ g(F.^
Future<void> test_IndexExpression() async {
// ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -2210,7 +2210,7 @@ g(F.^
Future<void> test_IndexExpression2() async {
// SimpleIdentifier IndexExpression ExpressionStatement Block
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {int x;}''');
@ -2229,7 +2229,7 @@ g(F.^
Future<void> test_InstanceCreationExpression_imported() async {
// SimpleIdentifier NamedType ConstructorName InstanceCreationExpression
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
class A {A(this.x) { } int x;}''');
@ -2259,7 +2259,7 @@ g(F.^
Future<void> test_InstanceCreationExpression_unimported() async {
// SimpleIdentifier NamedType ConstructorName InstanceCreationExpression
addSource('/testAB.dart', 'class Foo { }');
newFile('/testAB.dart', 'class Foo { }');
addTestSource('class C {foo(){new F^}}');
await computeSuggestions();
expect(replacementOffset, completionOffset - 1);
@ -2315,7 +2315,7 @@ void f() {
Future<void> test_InterpolationExpression() async {
// SimpleIdentifier InterpolationExpression StringInterpolation
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -2344,7 +2344,7 @@ void f() {
Future<void> test_InterpolationExpression_block() async {
// SimpleIdentifier InterpolationExpression StringInterpolation
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -2410,7 +2410,7 @@ void f() {
Future<void> test_IsExpression() async {
// SimpleIdentifier NamedType IsExpression IfStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class X {X.c(); X._d(); z() {}}''');
@ -2483,7 +2483,7 @@ void f() {
}
Future<void> test_keyword2() async {
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
int newT1;
int T1;
@ -2543,8 +2543,8 @@ void f() {
}
Future<void> test_libraryPrefix_with_exports() async {
addSource('$testPackageLibPath/a.dart', 'class A { }');
addSource('$testPackageLibPath/b.dart', 'export "a.dart"; class B { }');
newFile('$testPackageLibPath/a.dart', 'class A { }');
newFile('$testPackageLibPath/b.dart', 'export "a.dart"; class B { }');
addTestSource('import "b.dart" as foo; void f() {foo.^} class C { }');
await computeSuggestions();
// Suggested by LibraryMemberContributor
@ -2602,7 +2602,7 @@ void f() {
Future<void> test_MapLiteralEntry() async {
// MapLiteralEntry MapLiteral VariableDeclaration
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -2629,7 +2629,7 @@ void f() {
Future<void> test_MapLiteralEntry1() async {
// MapLiteralEntry MapLiteral VariableDeclaration
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -2649,7 +2649,7 @@ void f() {
Future<void> test_MapLiteralEntry2() async {
// SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -2869,7 +2869,7 @@ void f() {new C().^}''');
Future<void> test_MethodDeclaration_body_static() async {
// Block BlockFunctionBody MethodDeclaration
addSource('/testC.dart', '''
newFile('/testC.dart', '''
class C {
c1() {}
var c2;
@ -2948,7 +2948,7 @@ void f() {new C().^}''');
Future<void> test_MethodDeclaration_returnType() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -2976,7 +2976,7 @@ void f() {new C().^}''');
Future<void> test_MethodDeclaration_returnType_afterComment() async {
// ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -3004,7 +3004,7 @@ void f() {new C().^}''');
Future<void> test_MethodDeclaration_returnType_afterComment2() async {
// MethodDeclaration ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -3032,7 +3032,7 @@ void f() {new C().^}''');
Future<void> test_MethodDeclaration_returnType_afterComment3() async {
// MethodDeclaration ClassDeclaration CompilationUnit
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int T1;
F1() { }
typedef D1();
@ -3279,12 +3279,12 @@ void f() {C.^ print("something");}''');
Future<void> test_partFile_TypeName() async {
// SimpleIdentifier NamedType ConstructorName
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library libA;
import "b.dart";
part "${resourceProvider.pathContext.basename(testFile)}";
@ -3311,12 +3311,12 @@ void f() {C.^ print("something");}''');
Future<void> test_partFile_TypeName2() async {
// SimpleIdentifier NamedType ConstructorName
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
int T1;
F1() { }
class X {X.c(); X._d(); z() {}}''');
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
part of libA;
class B { }''');
addTestSource('''
@ -3343,7 +3343,7 @@ void f() {C.^ print("something");}''');
Future<void> test_PrefixedIdentifier_class_const() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
class I {
static const scI = 'boo';
@ -3389,7 +3389,7 @@ void f() {C.^ print("something");}''');
Future<void> test_PrefixedIdentifier_class_imported() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
class I {X get f => A();get _g => A();}
class A implements I {
@ -3465,7 +3465,7 @@ void f() {C.^ print("something");}''');
Future<void> test_PrefixedIdentifier_library() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@ -3491,7 +3491,7 @@ void f() {C.^ print("something");}''');
Future<void> test_PrefixedIdentifier_library_typesOnly() async {
// SimpleIdentifier PrefixedIdentifier NamedType
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@ -3517,7 +3517,7 @@ void f() {C.^ print("something");}''');
Future<void> test_PrefixedIdentifier_library_typesOnly2() async {
// SimpleIdentifier PrefixedIdentifier NamedType
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
var T1;
class X { }
@ -3543,7 +3543,7 @@ void f() {C.^ print("something");}''');
Future<void> test_PrefixedIdentifier_parameter() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
class _W {M y; var _z;}
class X extends _W {}
@ -3561,7 +3561,7 @@ void f() {C.^ print("something");}''');
Future<void> test_PrefixedIdentifier_prefix() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {static int bar = 10;}
_B() {}''');
addTestSource('''
@ -3697,7 +3697,7 @@ void f() {C.^ print("something");}''');
Future<void> test_PropertyAccess_noTarget() async {
// SimpleIdentifier PropertyAccess ExpressionStatement
addSource('/testAB.dart', 'class Foo { }');
newFile('/testAB.dart', 'class Foo { }');
addTestSource('class C {foo(){.^}}');
await computeSuggestions();
assertNoSuggestions();
@ -3705,7 +3705,7 @@ void f() {C.^ print("something");}''');
Future<void> test_PropertyAccess_noTarget2() async {
// SimpleIdentifier PropertyAccess ExpressionStatement
addSource('/testAB.dart', 'class Foo { }');
newFile('/testAB.dart', 'class Foo { }');
addTestSource('void f() {.^}');
await computeSuggestions();
assertNoSuggestions();
@ -4160,7 +4160,7 @@ class C with M {
Future<void> test_TypeArgumentList() async {
// SimpleIdentifier BinaryExpression ExpressionStatement
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class C1 {int x;}
F1() => 0;
typedef String T1(int blat);''');
@ -4185,7 +4185,7 @@ class C with M {
Future<void> test_TypeArgumentList2() async {
// NamedType TypeArgumentList NamedType
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class C1 {int x;}
F1() => 0;
typedef String T1(int blat);''');
@ -4229,7 +4229,7 @@ class C with M {
Future<void> test_VariableDeclaration_name() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement Block
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class _B { }
@ -4254,7 +4254,7 @@ class C with M {
Future<void> test_VariableDeclarationStatement_RHS() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
foo() { }
class _B { }
@ -4278,7 +4278,7 @@ class C with M {
Future<void> test_VariableDeclarationStatement_RHS_missing_semicolon() async {
// VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
lib B;
foo1() { }
void bar1() { }

View file

@ -929,7 +929,7 @@ class NonLibraryAnnotation {
const NonLibraryAnnotation();
}
''';
addSource(annotationsFile, annotationsContent);
newFile(annotationsFile, annotationsContent);
}
void _assertOrganize(String expectedCode, {bool removeUnused = false}) {

View file

@ -139,7 +139,7 @@ abstract class RefactoringTest extends AbstractSingleUnitTest {
}
Future<void> indexUnit(String file, String code) async {
addSource(file, code);
newFile(file, code);
}
@override

View file

@ -3287,7 +3287,7 @@ String res() => 'test';
}
void _addLibraryReturningAsync() {
addSource('$testPackageLibPath/asyncLib.dart', r'''
newFile('$testPackageLibPath/asyncLib.dart', r'''
import 'dart:async';
Completer<int> newCompleter() => null;

View file

@ -184,7 +184,7 @@ import 'package:test/new_name.dart';
Future<void> test_file_imported_with_relative_uri_down() async {
var pathA = convertPath('/home/test/000/1111/a.dart');
testFile = convertPath('/home/test/000/1111/test.dart');
addSource(pathA, '''
newFile(pathA, '''
import 'test.dart';
''');
await analyzeTestPackageFiles();
@ -204,7 +204,7 @@ import '22/new_name.dart';
// https://github.com/dart-lang/sdk/issues/45593
testFile = convertPath('/home/test/bin/aaa.dart');
var pathB = convertPath('/home/test/bin/bbb.dart');
addSource(pathB, '');
newFile(pathB, '');
await resolveTestCode("import 'bbb.dart';");
await analyzeTestPackageFiles();
@ -218,7 +218,7 @@ import '22/new_name.dart';
Future<void> test_file_imported_with_relative_uri_sideways() async {
var pathA = convertPath('/home/test/000/1111/a.dart');
testFile = convertPath('/home/test/000/1111/sub/folder/test.dart');
addSource(pathA, '''
newFile(pathA, '''
import 'sub/folder/test.dart';
''');
await analyzeTestPackageFiles();
@ -235,7 +235,7 @@ import '../new/folder/name/new_name.dart';
Future<void> test_file_imported_with_relative_uri_up() async {
var pathA = convertPath('/home/test/000/1111/a.dart');
testFile = convertPath('/home/test/000/1111/22/test.dart');
addSource(pathA, '''
newFile(pathA, '''
import '22/test.dart';
''');
await analyzeTestPackageFiles();
@ -251,7 +251,7 @@ import 'new_name.dart';
Future<void> test_file_moveOutOfLib() async {
var binMainPath = convertPath('/home/test/bin/main.dart');
addSource(binMainPath, '''
newFile(binMainPath, '''
import 'package:test/test.dart';
void f() {
@ -281,11 +281,11 @@ void f() {
var pathA = convertPath('/home/test/000/1111/a.dart');
var pathB = convertPath('/home/test/000/b.dart');
testFile = convertPath('/home/test/000/1111/22/test.dart');
addSource(pathA, '''
newFile(pathA, '''
library lib;
part '22/test.dart';
''');
addSource(pathB, '''
newFile(pathB, '''
library lib;
part '1111/22/test.dart';
''');
@ -309,7 +309,7 @@ part '1111/22/new_name.dart';
Future<void> test_file_referenced_by_part() async {
var pathA = convertPath('/home/test/000/1111/a.dart');
testFile = convertPath('/home/test/000/1111/22/test.dart');
addSource(pathA, '''
newFile(pathA, '''
library lib;
part '22/test.dart';
''');
@ -334,10 +334,10 @@ part '22/new_name.dart';
final pathC = convertPath('/home/test/lib/old/nested/c.dart');
final pathD = convertPath('/home/test/lib/old/nested/d.dart');
testFile = convertPath('/home/test/lib/test.dart');
addSource(pathA, '');
addSource(pathB, '');
addSource(pathC, '');
addSource(pathD, '');
newFile(pathA, '');
newFile(pathB, '');
newFile(pathC, '');
newFile(pathD, '');
verifyNoTestUnitErrors = false;
await resolveTestCode('''
import 'old/a.dart';
@ -371,7 +371,7 @@ import 'package:test/new/nested/d.dart';
Future<void> test_folder_siblingFiles() async {
testFile = convertPath('/home/test/lib/old/a.dart');
final pathB = convertPath('/home/test/lib/old/b.dart');
addSource(pathB, '');
newFile(pathB, '');
await resolveTestCode('''
import 'a.dart';
''');
@ -414,7 +414,7 @@ import 'a.dart';
// path to the parent changes).
var pathA = convertPath('/home/test/000/1111/a.dart');
testFile = convertPath('/home/test/000/1111/22/test.dart');
addSource(pathA, '''
newFile(pathA, '''
library lib;
part '22/test.dart';
''');
@ -441,7 +441,7 @@ part of '../../a.dart';
// path to the parent changes).
var pathA = convertPath('/home/test/000/1111/a.dart');
testFile = convertPath('/home/test/000/1111/test.dart');
addSource(pathA, '''
newFile(pathA, '''
part of 'test.dart';
''');
await resolveTestCode('''
@ -464,7 +464,7 @@ part '../a.dart';
// path to the parent changes).
var pathA = convertPath('/home/test/000/1111/a.dart');
testFile = convertPath('/home/test/000/1111/test.dart');
addSource(pathA, '''
newFile(pathA, '''
part of 'test.dart';
''');
await resolveTestCode('''
@ -485,7 +485,7 @@ part of 'test2.dart';
// path to the parent changes).
var pathA = convertPath('/home/test/000/1111/a.dart');
testFile = convertPath('/home/test/000/1111/test.dart');
addSource(pathA, '''
newFile(pathA, '''
part 'test.dart';
''');
addTestSource('''
@ -510,7 +510,7 @@ part of '../a.dart';
// path to the parent changes).
var pathA = convertPath('/home/test/000/1111/a.dart');
testFile = convertPath('/home/test/000/1111/test.dart');
addSource(pathA, '''
newFile(pathA, '''
part 'test.dart';
''');
addTestSource('''

View file

@ -35,7 +35,7 @@ library my.app;
}
Future<void> test_createChange() async {
addSource('$testPackageLibPath/part.dart', '''
newFile('$testPackageLibPath/part.dart', '''
part of my.app;
''');
await indexTestUnit('''
@ -58,7 +58,7 @@ part of the.new.name;
}
Future<void> test_createChange_hasWhitespaces() async {
addSource('$testPackageLibPath/part.dart', '''
newFile('$testPackageLibPath/part.dart', '''
part of my . app;
''');
await indexTestUnit('''

View file

@ -174,7 +174,7 @@ class Foo {
}
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
await expectTarget(
contents,
_isItem(
@ -221,7 +221,7 @@ extension StringExtension on String {
}
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
await expectTarget(
contents,
_isItem(
@ -298,7 +298,7 @@ void f() {
/*1*/void myFunction() {}/*1*/
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
await expectTarget(
contents,
_isItem(
@ -343,7 +343,7 @@ void f() {
/*1*/String get bar => '';/*1*/
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
await expectTarget(
contents,
_isItem(
@ -372,7 +372,7 @@ void f() {
/*1*/class Foo {}/*1*/
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
await expectTarget(
contents,
_isItem(
@ -457,7 +457,7 @@ class Foo {
}
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
await expectTarget(
contents,
_isItem(
@ -506,7 +506,7 @@ class Bar {
class Foo with Bar {}
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
await expectTarget(
contents,
_isItem(
@ -563,7 +563,7 @@ class Foo {
}
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
await expectTarget(
contents,
_isItem(
@ -591,7 +591,7 @@ class Foo {
}
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
await expectNoTarget(contents);
}
@ -627,7 +627,7 @@ void f() {
/*1*/set bar(String value) {}/*1*/
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
await expectTarget(
contents,
_isItem(
@ -702,7 +702,7 @@ final foo1 = Foo();
SourceRange rangeAfter(String prefix) =>
rangeAfterPrefix(prefix, otherContents, 'Foo');
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findIncomingCalls(contents);
expect(
calls,
@ -766,7 +766,7 @@ import 'test.dart';
SourceRange rangeAfter(String prefix) =>
rangeAfterPrefix(prefix, otherContents, 'myMethod');
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findIncomingCalls(contents);
expect(
calls,
@ -831,7 +831,7 @@ final foo1 = myFunction();
SourceRange rangeAfter(String prefix) =>
rangeAfterPrefix(prefix, otherContents, 'myFunction');
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findIncomingCalls(contents);
expect(
calls,
@ -902,7 +902,7 @@ final foo1 = foo;
SourceRange rangeAfter(String prefix) =>
rangeAfterPrefix(prefix, otherContents, 'foo');
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findIncomingCalls(contents);
expect(
calls,
@ -969,7 +969,7 @@ final foo2 = Foo();
SourceRange rangeAfter(String prefix, String code) =>
rangeAfterPrefix(prefix, code, 'Foo');
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findIncomingCalls(contents);
expect(
calls,
@ -1012,7 +1012,7 @@ import 'test.dart';
SourceRange rangeAfter(String prefix) =>
rangeAfterPrefix(prefix, otherContents, 'myMethod');
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findIncomingCalls(contents);
expect(
calls,
@ -1050,7 +1050,7 @@ import 'test.dart';
SourceRange rangeAfter(String prefix) =>
rangeAfterPrefix(prefix, otherContents, 'myMethod');
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findIncomingCalls(contents);
expect(
calls,
@ -1085,7 +1085,7 @@ import 'test.dart';
SourceRange rangeAfter(String prefix) =>
rangeAfterPrefix(prefix, otherContents, 'Bar');
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findIncomingCalls(contents);
expect(
calls,
@ -1124,7 +1124,7 @@ class Bar {
SourceRange rangeAfter(String prefix) =>
rangeAfterPrefix(prefix, otherContents, 'foo');
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findIncomingCalls(contents);
expect(
calls,
@ -1197,7 +1197,7 @@ class A {
}/*2*/
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findOutgoingCalls(contents);
expect(
calls,
@ -1241,7 +1241,7 @@ extension StringExtension on String {
}
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findOutgoingCalls(contents);
expect(
calls,
@ -1300,7 +1300,7 @@ void fo^o() {
/*1*/void f() {}/*1*/
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findOutgoingCalls(contents);
expect(
calls,
@ -1344,7 +1344,7 @@ String get fo^o {
}/*1*/
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findOutgoingCalls(contents);
expect(
calls,
@ -1386,7 +1386,7 @@ void f() {
class Foo {}
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findOutgoingCalls(contents);
expect(calls, isEmpty);
}
@ -1416,7 +1416,7 @@ class Foo {
}/*1*/
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findOutgoingCalls(contents);
expect(
calls,
@ -1464,7 +1464,7 @@ mixin OtherMixin {
/*1*/class A with OtherMixin {}/*1*/
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findOutgoingCalls(contents);
expect(
calls,
@ -1510,7 +1510,7 @@ class A {
}
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findOutgoingCalls(contents);
expect(
calls,
@ -1559,7 +1559,7 @@ set fo^o(String value) {
}/*1*/
''';
addSource(otherFile, otherContents);
newFile(otherFile, otherContents);
final calls = await findOutgoingCalls(contents);
expect(
calls,

View file

@ -26,7 +26,7 @@ class RuntimeCompletionComputerTest extends AbstractContextTest {
void addContextFile(String content) {
contextFile = convertPath('$testPackageLibPath/context.dart');
addSource(contextFile, content);
newFile(contextFile, content);
contextOffset = content.indexOf('// context line');
expect(contextOffset, isNonNegative,
@ -120,13 +120,13 @@ class B extends A {
@FailingTest(reason: 'No support for OverlayResourceProvider')
Future<void> test_inPart() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
part 'b.dart';
part 'context.dart';
int a;
''');
addSource('$testPackageLibPath/b.dart', r'''
newFile('$testPackageLibPath/b.dart', r'''
part of 'a.dart';
double b;

View file

@ -94,7 +94,7 @@ void f(List<String> items) {
}
Future<void> test_declaredIdentifier_addImport_dartUri() async {
addSource('$testPackageLibPath/my_lib.dart', r'''
newFile('$testPackageLibPath/my_lib.dart', r'''
import 'dart:collection';
List<HashMap<String, int>> getMap() => null;
''');
@ -198,7 +198,7 @@ void f() {
}
Future<void> test_local_addImport_dartUri() async {
addSource('$testPackageLibPath/my_lib.dart', r'''
newFile('$testPackageLibPath/my_lib.dart', r'''
import 'dart:collection';
HashMap<String, int> getMap() => null;
''');
@ -219,7 +219,7 @@ void f() {
}
Future<void> test_local_addImport_notLibraryUnit() async {
addSource('$testPackageLibPath/my_lib.dart', r'''
newFile('$testPackageLibPath/my_lib.dart', r'''
import 'dart:collection';
HashMap<String, int> getMap() => null;
''');
@ -237,7 +237,7 @@ void f() {
''');
var appPath = convertPath('$testPackageLibPath/app.dart');
addSource(appPath, appCode);
newFile(appPath, appCode);
await analyzeTestPackageFiles();
await resolveTestFile();
@ -262,10 +262,10 @@ part 'test.dart';
Future<void> test_local_addImport_relUri() async {
testFile = convertPath('/home/test/bin/test.dart');
addSource('/home/test/bin/aa/bbb/lib_a.dart', r'''
newFile('/home/test/bin/aa/bbb/lib_a.dart', r'''
class MyClass {}
''');
addSource('/home/test/bin/ccc/lib_b.dart', r'''
newFile('/home/test/bin/ccc/lib_b.dart', r'''
import '../aa/bbb/lib_a.dart';
MyClass newMyClass() => null;
''');
@ -744,7 +744,7 @@ void f() {
}
Future<void> test_privateType_closureParameter() async {
addSource('$testPackageLibPath/my_lib.dart', '''
newFile('$testPackageLibPath/my_lib.dart', '''
library my_lib;
class A {}
class _B extends A {}
@ -760,7 +760,7 @@ void f() {
}
Future<void> test_privateType_declaredIdentifier() async {
addSource('$testPackageLibPath/my_lib.dart', '''
newFile('$testPackageLibPath/my_lib.dart', '''
library my_lib;
class A {}
class _B extends A {}
@ -781,7 +781,7 @@ class A<T> {
Future<void> test_privateType_list() async {
// This is now failing because we're suggesting "List" rather than nothing.
// Is it really better to produce nothing?
addSource('$testPackageLibPath/my_lib.dart', '''
newFile('$testPackageLibPath/my_lib.dart', '''
library my_lib;
class A {}
class _B extends A {}
@ -819,7 +819,7 @@ void f() {
}
Future<void> test_privateType_variable() async {
addSource('$testPackageLibPath/my_lib.dart', '''
newFile('$testPackageLibPath/my_lib.dart', '''
library my_lib;
class A {}
class _B extends A {}

View file

@ -20,7 +20,7 @@ class ConvertPartOfToUriTest extends AssistProcessorTest {
AssistKind get kind => DartAssistKind.CONVERT_PART_OF_TO_URI;
Future<void> test_nonSibling() async {
addSource('$testPackageLibPath/foo.dart', '''
newFile('$testPackageLibPath/foo.dart', '''
library foo;
part 'src/bar.dart';
''');
@ -38,7 +38,7 @@ part of '../foo.dart';
}
Future<void> test_sibling() async {
addSource('$testPackageLibPath/foo.dart', '''
newFile('$testPackageLibPath/foo.dart', '''
library foo;
part 'bar.dart';
''');

View file

@ -21,7 +21,7 @@ class ConvertToPackageImportTest extends AssistProcessorTest {
AssistKind get kind => DartAssistKind.CONVERT_TO_PACKAGE_IMPORT;
Future<void> test_fileName_onImport() async {
addSource('$testPackageLibPath/foo.dart', '');
newFile('$testPackageLibPath/foo.dart', '');
await resolveTestCode('''
import 'foo.dart';
@ -33,7 +33,7 @@ import 'package:test/foo.dart';
}
Future<void> test_fileName_onUri() async {
addSource('$testPackageLibPath/foo.dart', '');
newFile('$testPackageLibPath/foo.dart', '');
await resolveTestCode('''
import 'foo.dart';
@ -52,7 +52,7 @@ import ':[invalidUri]';
}
Future<void> test_nonPackage_Uri() async {
addSource('$testPackageLibPath/foo.dart', '');
newFile('$testPackageLibPath/foo.dart', '');
testFile = convertPath('$testPackageLibPath/src/test.dart');
await resolveTestCode('''
import 'dart:core';
@ -63,7 +63,7 @@ import 'dart:core';
}
Future<void> test_packageUri() async {
addSource('$testPackageLibPath/foo.dart', '');
newFile('$testPackageLibPath/foo.dart', '');
await resolveTestCode('''
import 'package:test/foo.dart';
@ -73,7 +73,7 @@ import 'package:test/foo.dart';
}
Future<void> test_path() async {
addSource('$testPackageLibPath/foo/bar.dart', '');
newFile('$testPackageLibPath/foo/bar.dart', '');
testFile = convertPath('$testPackageLibPath/src/test.dart');
@ -89,7 +89,7 @@ import 'package:test/foo/bar.dart';
Future<void> test_relativeImport_noAssistWithLint() async {
createAnalysisOptionsFile(lints: [LintNames.avoid_relative_lib_imports]);
verifyNoTestUnitErrors = false;
addSource('$testPackageLibPath/foo.dart', '');
newFile('$testPackageLibPath/foo.dart', '');
await resolveTestCode('''
import '../lib/foo.dart';

View file

@ -47,7 +47,7 @@ void f(x) {
}
Future<void> test_mixinOnDirective() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
mixin M {}
''');
await resolveTestCode('''
@ -99,7 +99,7 @@ void f() {
}
Future<void> test_setterOnDirective() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
void set setter(int i) {}
''');
await resolveTestCode('''
@ -119,7 +119,7 @@ void f() {
}
Future<void> test_typedefOnDirective() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
typedef Cb = void Function();
''');
await resolveTestCode('''

View file

@ -162,7 +162,7 @@ void f() {
}
Future<void> test_privateType() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {
_B b => _B();
}

View file

@ -37,7 +37,7 @@ E e() {
}
Future<void> test_differentLibrary() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
enum E {ONE}
''');

View file

@ -40,7 +40,7 @@ class AddLateTest extends FixProcessorTest {
FixKind get kind => DartFixKind.ADD_LATE;
Future<void> test_changeInImportedLib() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class C {
final String s;
}
@ -60,7 +60,7 @@ class C {
}
Future<void> test_changeInPart() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
part 'test.dart';
class C {

View file

@ -104,7 +104,7 @@ void f() {
}
Future<void> test_constructor_single() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
class A {
A({required int a}) {}
}
@ -128,7 +128,7 @@ void f() {
}
Future<void> test_constructor_single_closure() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
typedef void VoidCallback();
class A {
@ -154,7 +154,7 @@ void f() {
}
Future<void> test_constructor_single_closure2() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
typedef void Callback(e);
class A {
@ -180,7 +180,7 @@ void f() {
}
Future<void> test_constructor_single_closure3() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
typedef void Callback(a,b,c);
class A {
@ -206,7 +206,7 @@ void f() {
}
Future<void> test_constructor_single_closure4() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
typedef int Callback(int a, String b,c);
class A {
@ -232,7 +232,7 @@ void f() {
}
Future<void> test_constructor_single_closure_nnbd() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
typedef int Callback(int? a);
class A {
@ -258,7 +258,7 @@ void f() {
}
Future<void> test_constructor_single_closure_nnbd_from_legacy() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
// @dart = 2.8
import 'package:meta/meta.dart';
@ -290,7 +290,7 @@ void f() {
Future<void> test_constructor_single_closure_nnbd_into_legacy() async {
noSoundNullSafety = false;
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
typedef int Callback(int? a);
class A {
@ -318,7 +318,7 @@ void f() {
}
Future<void> test_constructor_single_list() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
class A {
A({required List<String> names}) {}
}
@ -342,7 +342,7 @@ void f() {
}
Future<void> test_constructor_single_namedAnywhere() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
class A {
A(int a, int b, {int? c, required int d}) {}
}

View file

@ -192,7 +192,7 @@ class MyObject extends Object {
}
Future<void> test_privateType() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {
_B b => _B();
}

View file

@ -58,12 +58,12 @@ void f() {
}
Future<void> test_method_importType() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
class A {
static foo() {}
}
''');
addSource('$testPackageLibPath/b.dart', r'''
newFile('$testPackageLibPath/b.dart', r'''
import 'package:test/a.dart';
class B extends A {}
@ -142,12 +142,12 @@ void f() {
}
Future<void> test_property_importType() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
class A {
static get foo => null;
}
''');
addSource('$testPackageLibPath/b.dart', r'''
newFile('$testPackageLibPath/b.dart', r'''
import 'package:test/a.dart';
class B extends A {}

View file

@ -57,7 +57,7 @@ f() {
}
Future<void> test_privateType() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {
_B b => _B();
}

View file

@ -28,8 +28,8 @@ class ConvertToPackageImport_AlwaysUsePackageImportsBulkTest
Future<void> test_singleFile() async {
writeTestPackageConfig(config: PackageConfigFileBuilder());
addSource('$testPackageLibPath/foo.dart', 'class Foo {}');
addSource('$testPackageLibPath/bar.dart', 'class Bar {}');
newFile('$testPackageLibPath/foo.dart', 'class Foo {}');
newFile('$testPackageLibPath/bar.dart', 'class Bar {}');
testFile = convertPath('$testPackageLibPath/test.dart');
@ -86,7 +86,7 @@ class ConvertToPackageImport_AvoidRelativeLibImportsBulkTest
@FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/44673')
Future<void> test_singleFile() async {
writeTestPackageConfig(config: PackageConfigFileBuilder());
addSource('$testPackageLibPath/bar.dart', 'class Bar {}');
newFile('$testPackageLibPath/bar.dart', 'class Bar {}');
testFile = convertPath('/home/test/tool/test.dart');

View file

@ -23,10 +23,10 @@ class ConvertToRelativeImportBulkTest extends BulkFixProcessorTest {
String get lintCode => LintNames.prefer_relative_imports;
Future<void> test_singleFile() async {
addSource('$testPackageLibPath/foo.dart', '''
newFile('$testPackageLibPath/foo.dart', '''
class C {}
''');
addSource('$testPackageLibPath/bar.dart', '''
newFile('$testPackageLibPath/bar.dart', '''
class D {}
''');
testFile = convertPath('$testPackageLibPath/src/test.dart');
@ -55,7 +55,7 @@ class ConvertToRelativeImportTest extends FixProcessorLintTest {
String get lintCode => LintNames.prefer_relative_imports;
Future<void> test_relativeImport() async {
addSource('$testPackageLibPath/foo.dart', '''
newFile('$testPackageLibPath/foo.dart', '''
class C {}
''');
testFile = convertPath('$testPackageLibPath/src/test.dart');
@ -72,7 +72,7 @@ C? c;
Future<void> test_relativeImportDifferentPackages() async {
// Validate we don't get a fix with imports referencing different packages.
addSource('/home/test1/lib/foo.dart', '');
newFile('/home/test1/lib/foo.dart', '');
testFile = convertPath('/home/test2/lib/bar.dart');
await resolveTestCode('''
import 'package:test1/foo.dart';
@ -82,7 +82,7 @@ import 'package:test1/foo.dart';
}
Future<void> test_relativeImportGarbledUri() async {
addSource('$testPackageLibPath/foo.dart', '');
newFile('$testPackageLibPath/foo.dart', '');
testFile = convertPath('$testPackageLibPath/bar.dart');
await resolveTestCode('''
import 'package:test/foo';
@ -96,7 +96,7 @@ import 'foo';
}
Future<void> test_relativeImportRespectQuoteStyle() async {
addSource('$testPackageLibPath/foo.dart', '''
newFile('$testPackageLibPath/foo.dart', '''
class C {}
''');
testFile = convertPath('$testPackageLibPath/bar.dart');
@ -112,7 +112,7 @@ C? c;
}
Future<void> test_relativeImportSameDirectory() async {
addSource('$testPackageLibPath/foo.dart', '''
newFile('$testPackageLibPath/foo.dart', '''
class C {}
''');
testFile = convertPath('$testPackageLibPath/bar.dart');
@ -128,7 +128,7 @@ C? c;
}
Future<void> test_relativeImportSubDirectory() async {
addSource('$testPackageLibPath/baz/foo.dart', '''
newFile('$testPackageLibPath/baz/foo.dart', '''
class C {}
''');
testFile = convertPath('$testPackageLibPath/test.dart');

View file

@ -73,7 +73,7 @@ class BaseClass {
}
Future<void> test_inLibraryOfPrefix() async {
addSource('$testPackageLibPath/lib.dart', r'''
newFile('$testPackageLibPath/lib.dart', r'''
class A {}
''');

View file

@ -51,10 +51,10 @@ class B extends A {
}
Future<void> test_importType() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {}
''');
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
import 'package:test/a.dart';
class B {
@ -304,10 +304,10 @@ class B extends A {
}
Future<void> test_importType() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {}
''');
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
import 'package:test/a.dart';
class B {

View file

@ -130,7 +130,7 @@ void f(A a) {
}
Future<void> test_getter_qualified_instance_differentLibrary() async {
addSource('$testPackageLibPath/other.dart', '''
newFile('$testPackageLibPath/other.dart', '''
/**
* A comment to push the offset of the braces for the following class
* declaration past the end of the content of the test file. Used to catch an
@ -316,11 +316,11 @@ void f(A a) {
}
Future<void> test_importType() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
class A {}
''');
addSource('$testPackageLibPath/b.dart', r'''
newFile('$testPackageLibPath/b.dart', r'''
import 'package:test/a.dart';
A getA() => null;

View file

@ -259,10 +259,10 @@ int test(double a, String b) {
}
Future<void> test_functionType_importType() async {
addSource('$testPackageLibPath/a.dart', r'''
newFile('$testPackageLibPath/a.dart', r'''
class A {}
''');
addSource('$testPackageLibPath/b.dart', r'''
newFile('$testPackageLibPath/b.dart', r'''
import 'package:test/a.dart';
useFunction(int g(A a)) {}
@ -348,7 +348,7 @@ void process(Map items) {
}
Future<void> test_importType() async {
addSource('$testPackageLibPath/lib.dart', r'''
newFile('$testPackageLibPath/lib.dart', r'''
library lib;
import 'dart:async';
Future getFuture() => null;

View file

@ -248,7 +248,7 @@ void f(A a) {
}
Future<void> test_qualified_instance_differentLibrary() async {
addSource('$testPackageLibPath/other.dart', '''
newFile('$testPackageLibPath/other.dart', '''
/**
* A comment to push the offset of the braces for the following class
* declaration past the end of the content of the test file. Used to catch an

View file

@ -860,8 +860,8 @@ class D {
}
''';
addSource('$testPackageLibPath/test2.dart', code2);
addSource('$testPackageLibPath/test3.dart', r'''
newFile('$testPackageLibPath/test2.dart', code2);
newFile('$testPackageLibPath/test3.dart', r'''
library test3;
class E {}
''');
@ -885,7 +885,7 @@ class D {
}
Future<void> test_parameterType_inTargetUnit() async {
addSource('$testPackageLibPath/test2.dart', r'''
newFile('$testPackageLibPath/test2.dart', r'''
class D {
}

View file

@ -35,7 +35,7 @@ void f() {
var libCode = r'''
class A {}
''';
addSource('$testPackageLibPath/lib.dart', libCode);
newFile('$testPackageLibPath/lib.dart', libCode);
await resolveTestCode('''
import 'lib.dart' as lib;

View file

@ -244,7 +244,7 @@ void f(A a) {
}
Future<void> test_qualified_instance_differentLibrary() async {
addSource('$testPackageLibPath/other.dart', '''
newFile('$testPackageLibPath/other.dart', '''
/**
* A comment to push the offset of the braces for the following class
* declaration past the end of the content of the test file. Used to catch an

View file

@ -1173,7 +1173,7 @@ transforms:
- kind: 'rename'
newName: 'New'
''');
addSource('$testPackageLibPath/test.config', '''
newFile('$testPackageLibPath/test.config', '''
'Rename to New':
bulkApply: true
''');

View file

@ -414,7 +414,7 @@ String s = '';
}
Future<void> test_imports_relative() async {
addSource('$testPackageLibPath/a.dart', '');
newFile('$testPackageLibPath/a.dart', '');
await resolveTestCode('''
import 'a.dart';

View file

@ -40,10 +40,10 @@ class TransformSetManagerTest extends AbstractContextTest {
..add(name: 'p1', rootPath: '$workspaceRootPath/p1'),
);
addSource('/home/test/pubspec.yaml', '');
newFile('/home/test/pubspec.yaml', '');
var testFile = convertPath('$testPackageLibPath/test.dart');
addSource(testFile, '');
newFile(testFile, '');
var result = await (await session).getResolvedLibraryValid(testFile);
var sets = manager.forLibrary(result.element);
expect(sets, hasLength(2));
@ -80,10 +80,10 @@ class TransformSetManagerTest extends AbstractContextTest {
..add(name: 'p2', rootPath: '$workspaceRootPath/p2'),
);
addSource('/home/test/pubspec.yaml', '');
newFile('/home/test/pubspec.yaml', '');
var testFile = convertPath('$testPackageLibPath/test.dart');
addSource(testFile, '');
newFile(testFile, '');
var result = await (await session).getResolvedLibraryValid(testFile);
var sets = manager.forLibrary(result.element);
expect(sets, hasLength(2));
@ -92,9 +92,9 @@ class TransformSetManagerTest extends AbstractContextTest {
Future<void> test_zeroFiles() async {
// addTestPackageDependency('p1', '/.pub-cache/p1');
// addTestPackageDependency('p2', '/.pub-cache/p2');
addSource('/home/test/pubspec.yaml', '');
newFile('/home/test/pubspec.yaml', '');
var testFile = convertPath('$testPackageLibPath/test.dart');
addSource(testFile, '');
newFile(testFile, '');
var result = await (await session).getResolvedLibraryValid(testFile);
var sets = manager.forLibrary(result.element);
expect(sets, hasLength(0));

View file

@ -33,7 +33,7 @@ void f(prefix.HashMap a, prefix.HashMap b) {}
}
Future<void> test_withExtension() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
extension E on int {
static int foo() => 0;
}

View file

@ -24,7 +24,7 @@ class ImportLibraryProject1Test extends FixProcessorTest {
FixKind get kind => DartFixKind.IMPORT_LIBRARY_PROJECT1;
Future<void> test_alreadyImported_package() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
class A {}
class B {}
''');
@ -40,14 +40,14 @@ void f() {
}
Future<void> test_extension_notImported_field_onThisType_fromClass() async {
addSource('$testPackageLibPath/lib2.dart', '''
newFile('$testPackageLibPath/lib2.dart', '''
import 'package:test/lib1.dart';
extension E on C {
int m() => 0;
}
''');
addSource('$testPackageLibPath/lib1.dart', '''
newFile('$testPackageLibPath/lib1.dart', '''
class C {}
''');
await resolveTestCode('''
@ -68,7 +68,7 @@ class D extends C {
}
Future<void> test_extension_notImported_getter() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
extension E on String {
int get m => 0;
}
@ -88,11 +88,11 @@ void f(String s) {
}
Future<void> test_extension_notImported_getter_this() async {
addSource('$testPackageLibPath/lib1.dart', '''
newFile('$testPackageLibPath/lib1.dart', '''
class A {
}
''');
addSource('$testPackageLibPath/lib2.dart', '''
newFile('$testPackageLibPath/lib2.dart', '''
import 'package:test/lib1.dart';
extension E on A {
@ -121,7 +121,7 @@ class B extends A {
}
Future<void> test_extension_notImported_method() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
extension E on String {
void m() {}
}
@ -141,7 +141,7 @@ void f(String s) {
}
Future<void> test_extension_notImported_method_extendsGeneric() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
import 'package:test/lib1.dart';
extension E<T extends num> on List<T> {
@ -163,14 +163,14 @@ void f(List<int> l) {
}
Future<void> test_extension_notImported_method_onThisType_fromClass() async {
addSource('$testPackageLibPath/lib2.dart', '''
newFile('$testPackageLibPath/lib2.dart', '''
import 'package:test/lib1.dart';
extension E on C {
void m() {}
}
''');
addSource('$testPackageLibPath/lib1.dart', '''
newFile('$testPackageLibPath/lib1.dart', '''
class C {}
''');
await resolveTestCode('''
@ -196,14 +196,14 @@ class D extends C {
Future<void>
test_extension_notImported_method_onThisType_fromExtension() async {
addSource('$testPackageLibPath/lib2.dart', '''
newFile('$testPackageLibPath/lib2.dart', '''
import 'package:test/lib1.dart';
extension E on C {
void m() {}
}
''');
addSource('$testPackageLibPath/lib1.dart', '''
newFile('$testPackageLibPath/lib1.dart', '''
class C {}
''');
await resolveTestCode('''
@ -228,7 +228,7 @@ extension F on C {
}
Future<void> test_extension_notImported_operator() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
extension E on String {
String operator -(String other) => this;
}
@ -248,7 +248,7 @@ void f(String s) {
}
Future<void> test_extension_notImported_setter() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
extension E on String {
set m(int v) {}
}
@ -306,7 +306,7 @@ void f() {
}
Future<void> test_invalidUri_interpolation() async {
addSource('$testPackageLibPath/lib.dart', r'''
newFile('$testPackageLibPath/lib.dart', r'''
class Test {
const Test();
}
@ -419,7 +419,7 @@ void f() {
}
Future<void> test_notInLib() async {
addSource('/home/other/test/lib.dart', '''
newFile('/home/other/test/lib.dart', '''
class Test {}
''');
await resolveTestCode('''
@ -432,7 +432,7 @@ void f() {
}
Future<void> test_relativeDirective() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class Foo {}
''');
await resolveTestCode('''
@ -454,7 +454,7 @@ void f() { new Foo(); }
}
Future<void> test_relativeDirective_downOneDirectory() async {
addSource('$testPackageLibPath/dir/a.dart', '''
newFile('$testPackageLibPath/dir/a.dart', '''
class Foo {}
''');
await resolveTestCode('''
@ -471,7 +471,7 @@ void f() { new Foo(); }
Future<void> test_relativeDirective_preferRelativeImports() async {
createAnalysisOptionsFile(lints: [LintNames.prefer_relative_imports]);
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class Foo {}
''');
await resolveTestCode('''
@ -493,7 +493,7 @@ void f() { new Foo(); }
}
Future<void> test_relativeDirective_upOneDirectory() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class Foo {}
''');
testFile = convertPath('$testPackageLibPath/dir/test.dart');
@ -510,7 +510,7 @@ void f() { new Foo(); }
}
Future<void> test_withClass_annotation() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
library lib;
class Test {
const Test(int p);
@ -531,7 +531,7 @@ void f() {
}
Future<void> test_withClass_catchClause() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
class Test {}
''');
await resolveTestCode('''
@ -557,11 +557,11 @@ void f() {
}
Future<void> test_withClass_hasOtherLibraryWithPrefix() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
library a;
class One {}
''');
addSource('$testPackageLibPath/b.dart', '''
newFile('$testPackageLibPath/b.dart', '''
library b;
class One {}
class Two {}
@ -585,7 +585,7 @@ main () {
Future<void> test_withClass_inParentFolder() async {
testFile = convertPath('/home/test/bin/aaa/test.dart');
addSource('/home/test/bin/lib.dart', '''
newFile('/home/test/bin/lib.dart', '''
library lib;
class Test {}
''');
@ -607,7 +607,7 @@ void f() {
Future<void> test_withClass_inRelativeFolder() async {
testFile = convertPath('/home/test/bin/test.dart');
addSource('/home/test/tool/sub/folder/lib.dart', '''
newFile('/home/test/tool/sub/folder/lib.dart', '''
library lib;
class Test {}
''');
@ -629,7 +629,7 @@ void f() {
Future<void> test_withClass_inSameFolder() async {
testFile = convertPath('/home/test/bin/test.dart');
addSource('/home/test/bin/lib.dart', '''
newFile('/home/test/bin/lib.dart', '''
library lib;
class Test {}
''');
@ -650,7 +650,7 @@ void f() {
}
Future<void> test_withClass_instanceCreation_const() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
class Test {
const Test();
}
@ -670,7 +670,7 @@ void f() {
}
Future<void> test_withClass_instanceCreation_const_namedConstructor() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
class Test {
const Test.named();
}
@ -690,7 +690,7 @@ void f() {
}
Future<void> test_withClass_instanceCreation_implicit() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
class Test {
const Test();
}
@ -710,7 +710,7 @@ void f() {
}
Future<void> test_withClass_instanceCreation_new() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
class Test {
const Test();
}
@ -730,7 +730,7 @@ void f() {
}
Future<void> test_withClass_instanceCreation_new_namedConstructor() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
class Test {
Test.named();
}
@ -968,7 +968,7 @@ void f() {
}
Future<void> test_withFunction() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
library lib;
myFunction() {}
''');
@ -987,7 +987,7 @@ void f() {
}
Future<void> test_withFunction_functionTopLevelVariable() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
var myFunction = () {};
''');
await resolveTestCode('''
@ -1005,7 +1005,7 @@ void f() {
}
Future<void> test_withFunction_functionTopLevelVariableIdentifier() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
var myFunction = () {};
''');
await resolveTestCode('''
@ -1023,7 +1023,7 @@ void f() {
}
Future<void> test_withFunction_identifier() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
library lib;
myFunction() {}
''');
@ -1043,7 +1043,7 @@ void f() {
@failingTest
Future<void> test_withFunction_nonFunctionType() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
int zero = 0;
''');
await resolveTestCode('''
@ -1055,7 +1055,7 @@ void f() {
}
Future<void> test_withFunction_unresolvedMethod() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
library lib;
myFunction() {}
''');
@ -1078,7 +1078,7 @@ class A {
}
Future<void> test_withFunctionTypeAlias() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
library lib;
typedef MyFunction();
''');
@ -1099,7 +1099,7 @@ void f() {
}
Future<void> test_withGetter_read() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int get foo => 0;
''');
@ -1119,7 +1119,7 @@ void f() {
}
Future<void> test_withGetter_readWrite() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int get foo => 0;
''');
@ -1140,7 +1140,7 @@ void f() {
/// Not really useful, but shows what we have.
Future<void> test_withGetter_write() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
int get foo => 0;
''');
@ -1160,7 +1160,7 @@ void f() {
}
Future<void> test_withMixin() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
mixin Test {}
''');
await resolveTestCode('''
@ -1174,7 +1174,7 @@ class X = Object with Test;
}
Future<void> test_withSetter_assignment() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
set foo(int _) {}
''');
@ -1194,7 +1194,7 @@ void f() {
}
Future<void> test_withTopLevelVariable_annotation() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
const foo = 0;
''');
@ -1212,7 +1212,7 @@ void f() {}
}
Future<void> test_withTopLevelVariable_read() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
var foo = 0;
''');
@ -1232,7 +1232,7 @@ void f() {
}
Future<void> test_withTopLevelVariable_write() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
var foo = 0;
''');
@ -1363,7 +1363,7 @@ class ImportLibraryProject3Test extends FixProcessorTest {
FixKind get kind => DartFixKind.IMPORT_LIBRARY_PROJECT3;
Future<void> test_inLibSrc_thisContextRoot_extension() async {
addSource('$testPackageLibPath/src/lib.dart', '''
newFile('$testPackageLibPath/src/lib.dart', '''
extension E on int {
static String m() => '';
}

View file

@ -20,7 +20,7 @@ class ImportLibraryShowTest extends FixProcessorTest {
FixKind get kind => DartFixKind.IMPORT_LIBRARY_SHOW;
Future<void> test_extension_notShown_getter() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
class C {}
extension E on String {
int get m => 0;
@ -43,7 +43,7 @@ void f(String s, C c) {
}
Future<void> test_extension_notShown_method() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
class C {}
extension E on String {
void m() {}
@ -66,7 +66,7 @@ void f(String s, C c) {
}
Future<void> test_extension_notShown_operator() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
class C {}
extension E on String {
String operator -(String other) => this;
@ -89,7 +89,7 @@ void f(String s, C c) {
}
Future<void> test_extension_notShown_setter() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
class C {}
extension E on String {
set m(int v) {}
@ -112,7 +112,7 @@ void f(String s, C c) {
}
Future<void> test_override_samePackage() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
class A {}
extension E on int {
String m() => '';
@ -133,7 +133,7 @@ void f(A a) {
}
Future<void> test_package() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
class A {}
class B {}
''');
@ -175,7 +175,7 @@ void f() {
}
Future<void> test_static_samePackage() async {
addSource('$testPackageLibPath/lib.dart', '''
newFile('$testPackageLibPath/lib.dart', '''
class A {}
extension E on int {
static String m() => '';

View file

@ -172,7 +172,7 @@ class B extends A {
}
Future<void> test_privateType() async {
addSource('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {
_B b => _B();
}