Index: pkg/analysis_server/test/services/correction/fix_test.dart |
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart |
index 18b6a7ad658bde8ae57e384d41420c2758c5bd5e..8f3d30effc84565a00271d856921811798fcc27f 100644 |
--- a/pkg/analysis_server/test/services/correction/fix_test.dart |
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart |
@@ -65,9 +65,7 @@ main() { |
$lineWithTest |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
main() { |
bool b = true; |
$lineWithTest |
@@ -220,9 +218,7 @@ class Test { |
Test(this.a); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_FIELD_FORMAL_PARAMETERS, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_FIELD_FORMAL_PARAMETERS, ''' |
class Test { |
final int a; |
final int b; |
@@ -241,9 +237,7 @@ class Test { |
Test(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_FIELD_FORMAL_PARAMETERS, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_FIELD_FORMAL_PARAMETERS, ''' |
class Test { |
final int a; |
final int b; |
@@ -262,9 +256,7 @@ class Test { |
Test([this.c]); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_FIELD_FORMAL_PARAMETERS, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_FIELD_FORMAL_PARAMETERS, ''' |
class Test { |
final int a; |
final int b; |
@@ -291,9 +283,7 @@ main() { |
test(1); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL, ''' |
test([int i]) {} |
main() { |
test(1); |
@@ -308,9 +298,7 @@ main() { |
test(1); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, ''' |
test(int i, {int a}) {} |
main() { |
test(1); |
@@ -325,9 +313,7 @@ main() { |
test(1, 2.0); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, ''' |
test(int a, double d) {} |
main() { |
test(1, 2.0); |
@@ -342,9 +328,7 @@ main() { |
test(1); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, ''' |
test(int i) {} |
main() { |
test(1); |
@@ -361,9 +345,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL, ''' |
class A { |
test(int a, [double d]) {} |
main() { |
@@ -382,9 +364,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, ''' |
class A { |
test(int a, double d) {} |
main() { |
@@ -403,9 +383,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_REQUIRED, ''' |
class A { |
test(int i) {} |
main() { |
@@ -453,9 +431,7 @@ build() { |
test_addMissingRequiredArg_cons_single() async { |
_addMetaPackageSource(); |
- addSource( |
- '/libA.dart', |
- r''' |
+ addSource('/libA.dart', r''' |
library libA; |
import 'package:meta/meta.dart'; |
@@ -486,9 +462,7 @@ main() { |
test_addMissingRequiredArg_cons_single_closure() async { |
_addMetaPackageSource(); |
- addSource( |
- '/libA.dart', |
- r''' |
+ addSource('/libA.dart', r''' |
library libA; |
import 'package:meta/meta.dart'; |
@@ -521,9 +495,7 @@ main() { |
test_addMissingRequiredArg_cons_single_closure_2() async { |
_addMetaPackageSource(); |
- addSource( |
- '/libA.dart', |
- r''' |
+ addSource('/libA.dart', r''' |
library libA; |
import 'package:meta/meta.dart'; |
@@ -556,9 +528,7 @@ main() { |
test_addMissingRequiredArg_cons_single_closure_3() async { |
_addMetaPackageSource(); |
- addSource( |
- '/libA.dart', |
- r''' |
+ addSource('/libA.dart', r''' |
library libA; |
import 'package:meta/meta.dart'; |
@@ -591,9 +561,7 @@ main() { |
test_addMissingRequiredArg_cons_single_closure_4() async { |
_addMetaPackageSource(); |
- addSource( |
- '/libA.dart', |
- r''' |
+ addSource('/libA.dart', r''' |
library libA; |
import 'package:meta/meta.dart'; |
@@ -626,9 +594,7 @@ main() { |
test_addMissingRequiredArg_cons_single_list() async { |
_addMetaPackageSource(); |
- addSource( |
- '/libA.dart', |
- r''' |
+ addSource('/libA.dart', r''' |
library libA; |
import 'package:meta/meta.dart'; |
@@ -667,9 +633,7 @@ main() { |
test(a: 3); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT, ''' |
import 'package:meta/meta.dart'; |
test({@required int a, @required int bcd}) {} |
@@ -709,9 +673,7 @@ main() { |
change = filteredFixes.first.change; |
resultCode = SourceEdit.applySequence(testCode, change.edits[0].edits); |
// verify |
- expect( |
- resultCode, |
- ''' |
+ expect(resultCode, ''' |
import 'package:meta/meta.dart'; |
test({@required int a, @required int bcd}) {} |
@@ -732,9 +694,7 @@ main() { |
test(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT, ''' |
import 'package:meta/meta.dart'; |
test({@required int abc}) {} |
@@ -755,9 +715,7 @@ main() { |
test("foo"); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT, ''' |
import 'package:meta/meta.dart'; |
test(String x, {@required int abc}) {} |
@@ -778,9 +736,7 @@ main() { |
test(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT, ''' |
import 'package:meta/meta.dart'; |
test({@Required("Really who doesn't need an abc?") int abc}) {} |
@@ -799,9 +755,7 @@ void main(Stream<String> names) { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_ASYNC, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_ASYNC, ''' |
import 'dart:async'; |
Future main(Stream<String> names) async { |
await for (String name in names) { |
@@ -849,9 +803,7 @@ main() { |
expect(fileEdits, hasLength(1)); |
resultCode = SourceEdit.applySequence(testCode, fileEdits[0].edits); |
// verify |
- expect( |
- resultCode, |
- ''' |
+ expect(resultCode, ''' |
foo() {} |
main() async { |
await foo(); |
@@ -868,9 +820,7 @@ main() async { |
foo() {} |
main() => await foo(); |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_ASYNC, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_ASYNC, ''' |
foo() {} |
main() async => await foo(); |
'''); |
@@ -887,9 +837,7 @@ int main() { |
return 42; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_ASYNC, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_ASYNC, ''' |
import 'dart:async'; |
foo() {} |
@@ -912,9 +860,7 @@ Future<int> main() { |
return 42; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_ASYNC, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_ASYNC, ''' |
import 'dart:async'; |
foo() {} |
Future<int> main() async { |
@@ -935,9 +881,7 @@ dynamic main() { |
return 42; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_ASYNC, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_ASYNC, ''' |
foo() {} |
dynamic main() async { |
await foo(); |
@@ -957,9 +901,7 @@ main() { |
return 42; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_ASYNC, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_ASYNC, ''' |
foo() {} |
main() async { |
await foo(); |
@@ -974,9 +916,7 @@ main() { |
boolean v; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REPLACE_BOOLEAN_WITH_BOOL, |
- ''' |
+ await assertHasFix(DartFixKind.REPLACE_BOOLEAN_WITH_BOOL, ''' |
main() { |
bool v; |
} |
@@ -989,9 +929,7 @@ main(x) { |
x?.a.b.c; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REPLACE_WITH_NULL_AWARE, |
- ''' |
+ await assertHasFix(DartFixKind.REPLACE_WITH_NULL_AWARE, ''' |
main(x) { |
x?.a?.b?.c; |
} |
@@ -1004,9 +942,7 @@ main(x) { |
x?.a.b(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REPLACE_WITH_NULL_AWARE, |
- ''' |
+ await assertHasFix(DartFixKind.REPLACE_WITH_NULL_AWARE, ''' |
main(x) { |
x?.a?.b(); |
} |
@@ -1019,9 +955,7 @@ main(x) { |
x?.a().b; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REPLACE_WITH_NULL_AWARE, |
- ''' |
+ await assertHasFix(DartFixKind.REPLACE_WITH_NULL_AWARE, ''' |
main(x) { |
x?.a()?.b; |
} |
@@ -1037,9 +971,7 @@ main(A a) { |
a.foo(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO_STATIC_ACCESS, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO_STATIC_ACCESS, ''' |
class A { |
static foo() {} |
} |
@@ -1050,17 +982,13 @@ main(A a) { |
} |
test_changeToStaticAccess_method_importType() async { |
- addSource( |
- '/libA.dart', |
- r''' |
+ addSource('/libA.dart', r''' |
library libA; |
class A { |
static foo() {} |
} |
'''); |
- addSource( |
- '/libB.dart', |
- r''' |
+ addSource('/libB.dart', r''' |
library libB; |
import 'libA.dart'; |
class B extends A {} |
@@ -1071,9 +999,7 @@ main(B b) { |
b.foo(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO_STATIC_ACCESS, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO_STATIC_ACCESS, ''' |
import 'libA.dart'; |
import 'libB.dart'; |
main(B b) { |
@@ -1089,9 +1015,7 @@ main(pref.Future f) { |
f.wait([]); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO_STATIC_ACCESS, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO_STATIC_ACCESS, ''' |
import 'dart:async' as pref; |
main(pref.Future f) { |
pref.Future.wait([]); |
@@ -1108,9 +1032,7 @@ main(A a) { |
a.foo; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO_STATIC_ACCESS, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO_STATIC_ACCESS, ''' |
class A { |
static get foo => 42; |
} |
@@ -1121,17 +1043,13 @@ main(A a) { |
} |
test_changeToStaticAccess_property_importType() async { |
- addSource( |
- '/libA.dart', |
- r''' |
+ addSource('/libA.dart', r''' |
library libA; |
class A { |
static get foo => null; |
} |
'''); |
- addSource( |
- '/libB.dart', |
- r''' |
+ addSource('/libB.dart', r''' |
library libB; |
import 'libA.dart'; |
class B extends A {} |
@@ -1142,9 +1060,7 @@ main(B b) { |
b.foo; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO_STATIC_ACCESS, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO_STATIC_ACCESS, ''' |
import 'libA.dart'; |
import 'libB.dart'; |
main(B b) { |
@@ -1178,9 +1094,7 @@ main() { |
String v = <int>[]; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TYPE_ANNOTATION, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TYPE_ANNOTATION, ''' |
main() { |
List<int> v = <int>[]; |
} |
@@ -1193,9 +1107,7 @@ main() { |
String v = 'abc'.length; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TYPE_ANNOTATION, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TYPE_ANNOTATION, ''' |
main() { |
int v = 'abc'.length; |
} |
@@ -1208,9 +1120,7 @@ main() { |
Test v = null; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_CLASS, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_CLASS, ''' |
main() { |
Test v = null; |
} |
@@ -1253,9 +1163,7 @@ main() { |
expect(fileEdits, hasLength(1)); |
SourceFileEdit fileEdit = change.edits[0]; |
expect(fileEdit.file, '/lib.dart'); |
- expect( |
- SourceEdit.applySequence(libCode, fileEdit.edits), |
- r''' |
+ expect(SourceEdit.applySequence(libCode, fileEdit.edits), r''' |
library my.lib; |
class A {} |
@@ -1274,9 +1182,7 @@ f() { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_CLASS, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_CLASS, ''' |
f() { |
g() { |
Test v = null; |
@@ -1295,9 +1201,7 @@ main() { |
var a = [Test]; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_CLASS, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_CLASS, ''' |
main() { |
var a = [Test]; |
} |
@@ -1319,9 +1223,7 @@ class MyAnnotation { |
@MyAnnotation(int, const [Test]) |
main() {} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_CLASS, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_CLASS, ''' |
class MyAnnotation { |
const MyAnnotation(a, b); |
} |
@@ -1345,9 +1247,7 @@ class Test { |
final int c; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_CONSTRUCTOR_FOR_FINAL_FIELDS, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_CONSTRUCTOR_FOR_FINAL_FIELDS, ''' |
class Test { |
final int a; |
final int b = 2; |
@@ -1369,9 +1269,7 @@ main() { |
new A(1, 2.0); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_CONSTRUCTOR, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_CONSTRUCTOR, ''' |
class A { |
int field; |
@@ -1394,9 +1292,7 @@ main() { |
new A.named(1, 2.0); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_CONSTRUCTOR, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_CONSTRUCTOR, ''' |
class A { |
A.named(int i, double d); |
@@ -1416,9 +1312,7 @@ main() { |
new A.named(1); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_CONSTRUCTOR, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_CONSTRUCTOR, ''' |
class A { |
A.named(int i); |
} |
@@ -1454,9 +1348,7 @@ class B extends A { |
B() {} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_SUPER_CONSTRUCTOR_INVOCATION, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_SUPER_CONSTRUCTOR_INVOCATION, ''' |
class A { |
A(bool p1, int p2, double p3, String p4, {p5}); |
} |
@@ -1476,9 +1368,7 @@ class B extends A { |
B() : field = 42 {} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_SUPER_CONSTRUCTOR_INVOCATION, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_SUPER_CONSTRUCTOR_INVOCATION, ''' |
class A { |
A(int p); |
} |
@@ -1498,9 +1388,7 @@ class B extends A { |
B() {} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_SUPER_CONSTRUCTOR_INVOCATION, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_SUPER_CONSTRUCTOR_INVOCATION, ''' |
class A { |
A.named(int p); |
} |
@@ -1531,9 +1419,7 @@ class B extends A<int> { |
B(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_SUPER_CONSTRUCTOR_INVOCATION, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_SUPER_CONSTRUCTOR_INVOCATION, ''' |
class A<T> { |
A(T p); |
} |
@@ -1554,9 +1440,7 @@ class B extends A { |
void existingMethod() {} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_CONSTRUCTOR_SUPER, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_CONSTRUCTOR_SUPER, ''' |
class A { |
A(p1, int p2, List<String> p3, [int p4]); |
} |
@@ -1582,9 +1466,7 @@ class B extends A { |
void existingMethod() {} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_CONSTRUCTOR_SUPER, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_CONSTRUCTOR_SUPER, ''' |
class A { |
int _field; |
A(this._field); |
@@ -1600,15 +1482,11 @@ class B extends A { |
} |
test_createConstructorSuperImplicit_importType() async { |
- addSource( |
- '/libA.dart', |
- r''' |
+ addSource('/libA.dart', r''' |
library libA; |
class A {} |
'''); |
- addSource( |
- '/libB.dart', |
- r''' |
+ addSource('/libB.dart', r''' |
library libB; |
import 'libA.dart'; |
class B { |
@@ -1620,9 +1498,7 @@ import 'libB.dart'; |
class C extends B { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_CONSTRUCTOR_SUPER, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_CONSTRUCTOR_SUPER, ''' |
import 'libA.dart'; |
import 'libB.dart'; |
class C extends B { |
@@ -1642,9 +1518,7 @@ class B extends A { |
void existingMethod() {} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_CONSTRUCTOR_SUPER, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_CONSTRUCTOR_SUPER, ''' |
class A { |
A.named(p1, int p2); |
} |
@@ -1677,9 +1551,7 @@ class C<T> { |
} |
class D extends C<int> { |
}'''); |
- await assertHasFix( |
- DartFixKind.CREATE_CONSTRUCTOR_SUPER, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_CONSTRUCTOR_SUPER, ''' |
class C<T> { |
final T x; |
C(this.x); |
@@ -1724,9 +1596,7 @@ main(C c) { |
int v = c.b.a.test; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class A { |
int test; |
} |
@@ -1750,9 +1620,7 @@ main(A a) { |
int v = a.test; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class A { |
int test; |
} |
@@ -1773,9 +1641,7 @@ class A { |
class B { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class A { |
B b; |
void f(Object p) { |
@@ -1798,9 +1664,7 @@ main() { |
int v = a.self.test; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class A { |
int test; |
@@ -1822,9 +1686,7 @@ class A { |
} |
f(String s) {} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class A { |
String test; |
@@ -1844,9 +1706,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class A { |
int test; |
@@ -1865,9 +1725,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class A { |
var test; |
@@ -1887,9 +1745,7 @@ main(A a) { |
int v = x.test; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class A { |
int test; |
} |
@@ -1909,9 +1765,7 @@ main(A a) { |
x.test = 0; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class A { |
int test; |
} |
@@ -1923,15 +1777,11 @@ main(A a) { |
} |
test_createField_importType() async { |
- addSource( |
- '/libA.dart', |
- r''' |
+ addSource('/libA.dart', r''' |
library libA; |
class A {} |
'''); |
- addSource( |
- '/libB.dart', |
- r''' |
+ addSource('/libB.dart', r''' |
library libB; |
import 'libA.dart'; |
A getA() => null; |
@@ -1944,9 +1794,7 @@ main(C c) { |
c.test = getA(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
import 'libA.dart'; |
import 'libB.dart'; |
class C { |
@@ -1964,9 +1812,7 @@ class C { |
C(this.text); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class C { |
var text; |
@@ -1981,9 +1827,7 @@ class C { |
C(String this.text); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class C { |
String text; |
@@ -2003,9 +1847,7 @@ class B<T> { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class A { |
List test; |
} |
@@ -2028,9 +1870,7 @@ class A<T> { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class A<T> { |
List<T> items; |
@@ -2055,9 +1895,7 @@ main(A a) { |
a.test = 5; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class A { |
int aaa; |
int zzz; |
@@ -2081,9 +1919,7 @@ main(A a) { |
a.test = 5; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class A { |
int test; |
@@ -2103,9 +1939,7 @@ main() { |
A.test = 5; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class A { |
static int test; |
} |
@@ -2123,9 +1957,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class A { |
int test; |
@@ -2144,9 +1976,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FIELD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FIELD, ''' |
class A { |
static int test; |
@@ -2253,18 +2083,14 @@ part 'my_part.dart'; |
} |
test_createFile_forPart_inPackageLib() async { |
- provider.newFile( |
- '/my/pubspec.yaml', |
- r''' |
+ provider.newFile('/my/pubspec.yaml', r''' |
name: my_test |
'''); |
testFile = '/my/lib/test.dart'; |
- addTestSource( |
- ''' |
+ addTestSource(''' |
library my.lib; |
part 'my_part.dart'; |
-''', |
- Uri.parse('package:my/test.dart')); |
+''', Uri.parse('package:my/test.dart')); |
// configure SourceFactory |
UriResolver pkgResolver = new PackageMapUriResolver(provider, { |
'my': <Folder>[provider.getResource('/my/lib')], |
@@ -2305,9 +2131,7 @@ main(A a) { |
int v = x.test; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_GETTER, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_GETTER, ''' |
class A { |
int get test => null; |
} |
@@ -2331,9 +2155,7 @@ main(A a) { |
int v = a.test; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_GETTER, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_GETTER, ''' |
class A { |
int existingField; |
@@ -2363,9 +2185,7 @@ main(C c) { |
int v = c.b.a.test; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_GETTER, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_GETTER, ''' |
class A { |
int get test => null; |
} |
@@ -2389,9 +2209,7 @@ main(A a) { |
int v = a.test; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_GETTER, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_GETTER, ''' |
class A { |
int get test => null; |
} |
@@ -2412,9 +2230,7 @@ class A { |
class B { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_GETTER, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_GETTER, ''' |
class A { |
B b; |
void f(Object p) { |
@@ -2437,9 +2253,7 @@ main() { |
int v = a.self.test; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_GETTER, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_GETTER, ''' |
class A { |
A get self => this; |
@@ -2472,9 +2286,7 @@ class A { |
} |
f(String s) {} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_GETTER, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_GETTER, ''' |
class A { |
String get test => null; |
@@ -2505,9 +2317,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_GETTER, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_GETTER, ''' |
class A { |
int get test => null; |
@@ -2526,9 +2336,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_GETTER, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_GETTER, ''' |
class A { |
get test => null; |
@@ -2547,9 +2355,7 @@ main() { |
foo(bar); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_LOCAL_VARIABLE, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_LOCAL_VARIABLE, ''' |
typedef MY_FUNCTION(int p); |
foo(MY_FUNCTION f) {} |
main() { |
@@ -2575,9 +2381,7 @@ main() { |
int a = test; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_LOCAL_VARIABLE, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_LOCAL_VARIABLE, ''' |
main() { |
int test; |
int a = test; |
@@ -2593,9 +2397,7 @@ main() { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_LOCAL_VARIABLE, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_LOCAL_VARIABLE, ''' |
main() { |
bool test; |
if (!test) { |
@@ -2612,9 +2414,7 @@ main() { |
} |
f(String p) {} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_LOCAL_VARIABLE, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_LOCAL_VARIABLE, ''' |
main() { |
String test; |
f(test); |
@@ -2631,9 +2431,7 @@ main() { |
test.add('hello'); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_LOCAL_VARIABLE, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_LOCAL_VARIABLE, ''' |
main() { |
var test; |
test.add('hello'); |
@@ -2648,9 +2446,7 @@ main() { |
test = 42; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_LOCAL_VARIABLE, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_LOCAL_VARIABLE, ''' |
main() { |
var test = 42; |
} |
@@ -2663,9 +2459,7 @@ main() { |
test += 42; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_LOCAL_VARIABLE, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_LOCAL_VARIABLE, ''' |
main() { |
int test; |
test += 42; |
@@ -2678,9 +2472,7 @@ main() { |
class C implements Function { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_MISSING_METHOD_CALL, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_MISSING_METHOD_CALL, ''' |
class C implements Function { |
call() { |
// TODO: implement call |
@@ -2698,9 +2490,7 @@ class A { |
class B implements A { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_MISSING_OVERRIDES, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_MISSING_OVERRIDES, ''' |
class A { |
var f; |
} |
@@ -2723,9 +2513,7 @@ abstract class Emulator { |
class MyEmulator extends Emulator { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_MISSING_OVERRIDES, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_MISSING_OVERRIDES, ''' |
typedef int Binary(int left, int right); |
abstract class Emulator { |
@@ -2750,9 +2538,7 @@ abstract class A { |
class B extends A { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_MISSING_OVERRIDES, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_MISSING_OVERRIDES, ''' |
abstract class A { |
forEach(int f(double p1, String p2)); |
} |
@@ -2778,9 +2564,7 @@ abstract class IterableMixin<T> { |
class Test extends IterableMixin<int> { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_MISSING_OVERRIDES, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_MISSING_OVERRIDES, ''' |
class Iterator<T> { |
} |
@@ -2805,9 +2589,7 @@ abstract class ItemProvider<T> { |
class Test<V> extends ItemProvider<V> { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_MISSING_OVERRIDES, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_MISSING_OVERRIDES, ''' |
abstract class ItemProvider<T> { |
List<T> getItems(); |
} |
@@ -2831,9 +2613,7 @@ abstract class A { |
class B extends A { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_MISSING_OVERRIDES, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_MISSING_OVERRIDES, ''' |
abstract class A { |
get g1; |
int get g2; |
@@ -2861,9 +2641,7 @@ abstract class A { |
class B extends A { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_MISSING_OVERRIDES, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_MISSING_OVERRIDES, ''' |
import 'dart:async' as aaa; |
abstract class A { |
Map<aaa.Future, List<aaa.Future>> g(aaa.Future p); |
@@ -2889,9 +2667,7 @@ class A { |
class B implements A { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_MISSING_OVERRIDES, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_MISSING_OVERRIDES, ''' |
class A { |
int ma; |
void mb() {} |
@@ -2994,9 +2770,7 @@ abstract class A { |
class B extends A {} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_MISSING_OVERRIDES, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_MISSING_OVERRIDES, ''' |
abstract class A { |
void foo(); |
} |
@@ -3022,9 +2796,7 @@ abstract class A { |
class B implements A { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_MISSING_OVERRIDES, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_MISSING_OVERRIDES, ''' |
class C<T> {} |
class V<E> {} |
@@ -3051,9 +2823,7 @@ abstract class A { |
class B extends A { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_MISSING_OVERRIDES, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_MISSING_OVERRIDES, ''' |
abstract class A { |
int operator [](int index); |
void operator []=(int index, String value); |
@@ -3084,9 +2854,7 @@ abstract class A { |
class B extends A { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_MISSING_OVERRIDES, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_MISSING_OVERRIDES, ''' |
abstract class A { |
set s1(x); |
set s2(int x); |
@@ -3123,9 +2891,7 @@ class B extends A { |
existing() {} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_NO_SUCH_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_NO_SUCH_METHOD, ''' |
abstract class A { |
m1(); |
int m2(); |
@@ -3153,9 +2919,7 @@ main() { |
a..ma().useFunction(test); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
class A { |
B ma() => null; |
} |
@@ -3180,9 +2944,7 @@ main() { |
} |
useFunction({Function g}) {} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
main() { |
useFunction(g: test); |
} |
@@ -3200,9 +2962,7 @@ main() { |
} |
useFunction(int g(a, b)) {} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
main() { |
useFunction(test); |
} |
@@ -3220,9 +2980,7 @@ main() { |
} |
useFunction(int g(double a, String b)) {} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
main() { |
useFunction(test); |
} |
@@ -3240,9 +2998,7 @@ main() { |
} |
useFunction({int g(double a, String b)}) {} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
main() { |
useFunction(g: test); |
} |
@@ -3254,15 +3010,11 @@ int test(double a, String b) { |
} |
test_creationFunction_forFunctionType_importType() async { |
- addSource( |
- '/libA.dart', |
- r''' |
+ addSource('/libA.dart', r''' |
library libA; |
class A {} |
'''); |
- addSource( |
- '/libB.dart', |
- r''' |
+ addSource('/libB.dart', r''' |
library libB; |
import 'libA.dart'; |
useFunction(int g(A a)) {} |
@@ -3273,9 +3025,7 @@ main() { |
useFunction(test); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
import 'libA.dart'; |
import 'libB.dart'; |
main() { |
@@ -3296,9 +3046,7 @@ class A { |
} |
useFunction(int g(double a, String b)) {} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
class A { |
static foo() { |
useFunction(test); |
@@ -3319,9 +3067,7 @@ class A { |
} |
useFunction(int g(double a, String b)) {} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
class A { |
var f; |
A() : f = useFunction(test); |
@@ -3342,9 +3088,7 @@ class A { |
} |
useFunction(int g(double a, String b)) {} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
main(A a) { |
useFunction(a.test); |
} |
@@ -3366,9 +3110,7 @@ class A { |
} |
useFunction(int g(double a, String b)) {} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
main(A a) { |
useFunction(a.test); |
} |
@@ -3412,9 +3154,7 @@ main() { |
print(0) |
} |
'''); |
- await assertHasFix( |
- DartFixKind.INSERT_SEMICOLON, |
- ''' |
+ await assertHasFix(DartFixKind.INSERT_SEMICOLON, ''' |
main() { |
print(0); |
} |
@@ -3429,9 +3169,7 @@ main() { |
import 'dart:async'; |
var v;int main() async => 0; |
'''); |
- await assertHasFix( |
- DartFixKind.REPLACE_RETURN_TYPE_FUTURE, |
- ''' |
+ await assertHasFix(DartFixKind.REPLACE_RETURN_TYPE_FUTURE, ''' |
import 'dart:async'; |
var v;Future<int> main() async => 0; |
'''); |
@@ -3446,9 +3184,7 @@ library main; |
int main() async { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REPLACE_RETURN_TYPE_FUTURE, |
- ''' |
+ await assertHasFix(DartFixKind.REPLACE_RETURN_TYPE_FUTURE, ''' |
library main; |
import 'dart:async'; |
@@ -3467,9 +3203,7 @@ import 'dart:async' as al; |
int main() async { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REPLACE_RETURN_TYPE_FUTURE, |
- ''' |
+ await assertHasFix(DartFixKind.REPLACE_RETURN_TYPE_FUTURE, ''' |
import 'dart:async' as al; |
al.Future<int> main() async { |
} |
@@ -3485,9 +3219,7 @@ import 'dart:async'; |
List<int> main() async { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REPLACE_RETURN_TYPE_FUTURE, |
- ''' |
+ await assertHasFix(DartFixKind.REPLACE_RETURN_TYPE_FUTURE, ''' |
import 'dart:async'; |
Future<List<int>> main() async { |
} |
@@ -3503,9 +3235,7 @@ import 'dart:async'; |
void main() async { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REPLACE_RETURN_TYPE_FUTURE, |
- ''' |
+ await assertHasFix(DartFixKind.REPLACE_RETURN_TYPE_FUTURE, ''' |
import 'dart:async'; |
Future main() async { |
} |
@@ -3519,18 +3249,14 @@ main() { |
Test test = null; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PROJECT1, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT1, ''' |
import 'package:my_pkg/b.dart'; |
main() { |
Test test = null; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PROJECT2, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT2, ''' |
import 'package:my_pkg/a.dart'; |
main() { |
@@ -3547,18 +3273,14 @@ main() { |
Test test = null; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PROJECT1, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT1, ''' |
import 'package:my_pkg/b.dart'; |
main() { |
Test test = null; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PROJECT2, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT2, ''' |
import 'package:my_pkg/a.dart'; |
main() { |
@@ -3575,18 +3297,14 @@ main() { |
Test test = null; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PROJECT2, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT2, ''' |
import 'package:my_pkg/b.dart'; |
main() { |
Test test = null; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PROJECT3, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT3, ''' |
import 'package:my_pkg/src/a.dart'; |
main() { |
@@ -3622,9 +3340,7 @@ main() { |
} |
test_importLibraryProject_withClass_annotation() async { |
- addSource( |
- '/lib.dart', |
- ''' |
+ addSource('/lib.dart', ''' |
library lib; |
class Test { |
const Test(int p); |
@@ -3635,9 +3351,7 @@ class Test { |
main() { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PROJECT1, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT1, ''' |
import 'lib.dart'; |
@Test(0) |
@@ -3647,9 +3361,7 @@ main() { |
} |
test_importLibraryProject_withClass_constInstanceCreation() async { |
- addSource( |
- '/lib.dart', |
- ''' |
+ addSource('/lib.dart', ''' |
class Test { |
const Test(); |
} |
@@ -3659,9 +3371,7 @@ main() { |
const Test(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PROJECT1, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT1, ''' |
import 'lib.dart'; |
main() { |
@@ -3672,15 +3382,11 @@ main() { |
test_importLibraryProject_withClass_hasOtherLibraryWithPrefix() async { |
testFile = '/project/bin/test.dart'; |
- addSource( |
- '/project/bin/a.dart', |
- ''' |
+ addSource('/project/bin/a.dart', ''' |
library a; |
class One {} |
'''); |
- addSource( |
- '/project/bin/b.dart', |
- ''' |
+ addSource('/project/bin/b.dart', ''' |
library b; |
class One {} |
class Two {} |
@@ -3692,9 +3398,7 @@ main () { |
new One(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PROJECT1, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT1, ''' |
import 'a.dart'; |
import 'b.dart' show Two; |
main () { |
@@ -3706,9 +3410,7 @@ main () { |
test_importLibraryProject_withClass_inParentFolder() async { |
testFile = '/project/bin/test.dart'; |
- addSource( |
- '/project/lib.dart', |
- ''' |
+ addSource('/project/lib.dart', ''' |
library lib; |
class Test {} |
'''); |
@@ -3717,9 +3419,7 @@ main() { |
Test t = null; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PROJECT1, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT1, ''' |
import '../lib.dart'; |
main() { |
@@ -3730,9 +3430,7 @@ main() { |
test_importLibraryProject_withClass_inRelativeFolder() async { |
testFile = '/project/bin/test.dart'; |
- addSource( |
- '/project/lib/sub/folder/lib.dart', |
- ''' |
+ addSource('/project/lib/sub/folder/lib.dart', ''' |
library lib; |
class Test {} |
'''); |
@@ -3741,9 +3439,7 @@ main() { |
Test t = null; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PROJECT1, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT1, ''' |
import '../lib/sub/folder/lib.dart'; |
main() { |
@@ -3754,9 +3450,7 @@ main() { |
test_importLibraryProject_withClass_inSameFolder() async { |
testFile = '/project/bin/test.dart'; |
- addSource( |
- '/project/bin/lib.dart', |
- ''' |
+ addSource('/project/bin/lib.dart', ''' |
library lib; |
class Test {} |
'''); |
@@ -3765,9 +3459,7 @@ main() { |
Test t = null; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PROJECT1, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT1, ''' |
import 'lib.dart'; |
main() { |
@@ -3777,9 +3469,7 @@ main() { |
} |
test_importLibraryProject_withFunction() async { |
- addSource( |
- '/lib.dart', |
- ''' |
+ addSource('/lib.dart', ''' |
library lib; |
myFunction() {} |
'''); |
@@ -3788,9 +3478,7 @@ main() { |
myFunction(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PROJECT1, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT1, ''' |
import 'lib.dart'; |
main() { |
@@ -3800,9 +3488,7 @@ main() { |
} |
test_importLibraryProject_withFunction_unresolvedMethod() async { |
- addSource( |
- '/lib.dart', |
- ''' |
+ addSource('/lib.dart', ''' |
library lib; |
myFunction() {} |
'''); |
@@ -3813,9 +3499,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PROJECT1, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT1, ''' |
import 'lib.dart'; |
class A { |
@@ -3828,9 +3512,7 @@ class A { |
test_importLibraryProject_withFunctionTypeAlias() async { |
testFile = '/project/bin/test.dart'; |
- addSource( |
- '/project/bin/lib.dart', |
- ''' |
+ addSource('/project/bin/lib.dart', ''' |
library lib; |
typedef MyFunction(); |
'''); |
@@ -3839,9 +3521,7 @@ main() { |
MyFunction t = null; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PROJECT1, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT1, ''' |
import 'lib.dart'; |
main() { |
@@ -3851,9 +3531,7 @@ main() { |
} |
test_importLibraryProject_withTopLevelVariable() async { |
- addSource( |
- '/lib.dart', |
- ''' |
+ addSource('/lib.dart', ''' |
library lib; |
int MY_VAR = 42; |
'''); |
@@ -3862,9 +3540,7 @@ main() { |
print(MY_VAR); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PROJECT1, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT1, ''' |
import 'lib.dart'; |
main() { |
@@ -3879,9 +3555,7 @@ main(p) { |
p as Future; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_SDK, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_SDK, ''' |
import 'dart:async'; |
main(p) { |
@@ -3896,9 +3570,7 @@ main() { |
Future.wait(null); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_SDK, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_SDK, ''' |
import 'dart:async'; |
main() { |
@@ -3913,9 +3585,7 @@ main(p) { |
p is Future; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_SDK, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_SDK, ''' |
import 'dart:async'; |
main(p) { |
@@ -3930,9 +3600,7 @@ main() { |
var a = [Future]; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_SDK, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_SDK, ''' |
import 'dart:async'; |
main() { |
@@ -3952,9 +3620,7 @@ class MyAnnotation { |
@MyAnnotation(int, const [Future]) |
main() {} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_SDK, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_SDK, ''' |
import 'dart:async'; |
class MyAnnotation { |
@@ -3971,9 +3637,7 @@ main() { |
Future f = null; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_SDK, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_SDK, ''' |
import 'dart:async'; |
main() { |
@@ -3988,9 +3652,7 @@ main() { |
Future.wait; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_SDK, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_SDK, ''' |
import 'dart:async'; |
main() { |
@@ -4005,9 +3667,7 @@ main() { |
List<Future> futures = []; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_SDK, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_SDK, ''' |
import 'dart:async'; |
main() { |
@@ -4022,9 +3682,7 @@ main() { |
print(PI); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_SDK, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_SDK, ''' |
import 'dart:math'; |
main() { |
@@ -4039,9 +3697,7 @@ main() { |
main() { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_SDK, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_SDK, ''' |
import 'dart:math'; |
@PI |
@@ -4052,9 +3708,7 @@ main() { |
test_importLibraryShow_project() async { |
testFile = '/project/bin/test.dart'; |
- addSource( |
- '/project/bin/lib.dart', |
- ''' |
+ addSource('/project/bin/lib.dart', ''' |
class A {} |
class B {} |
'''); |
@@ -4066,9 +3720,7 @@ main() { |
} |
'''); |
await assertNoFix(DartFixKind.IMPORT_LIBRARY_PROJECT1); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_SHOW, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_SHOW, ''' |
import 'lib.dart' show A, B; |
main() { |
A a; |
@@ -4086,9 +3738,7 @@ main() { |
} |
'''); |
await assertNoFix(DartFixKind.IMPORT_LIBRARY_SDK); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_SHOW, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_SHOW, ''' |
import 'dart:async' show Future, Stream; |
main() { |
Stream s = null; |
@@ -4106,9 +3756,7 @@ main() { |
C c = C.c(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.INVOKE_CONSTRUCTOR_USING_NEW, |
- ''' |
+ await assertHasFix(DartFixKind.INVOKE_CONSTRUCTOR_USING_NEW, ''' |
class C { |
C.c(); |
} |
@@ -4124,9 +3772,7 @@ main(p) { |
p is! Null; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.USE_NOT_EQ_NULL, |
- ''' |
+ await assertHasFix(DartFixKind.USE_NOT_EQ_NULL, ''' |
main(p) { |
p != null; |
} |
@@ -4139,9 +3785,7 @@ main(p) { |
p is Null; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.USE_EQ_EQ_NULL, |
- ''' |
+ await assertHasFix(DartFixKind.USE_EQ_EQ_NULL, ''' |
main(p) { |
p == null; |
} |
@@ -4154,9 +3798,7 @@ class A { |
m(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.MAKE_CLASS_ABSTRACT, |
- ''' |
+ await assertHasFix(DartFixKind.MAKE_CLASS_ABSTRACT, ''' |
abstract class A { |
m(); |
} |
@@ -4171,9 +3813,7 @@ abstract class A { |
class B extends A { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.MAKE_CLASS_ABSTRACT, |
- ''' |
+ await assertHasFix(DartFixKind.MAKE_CLASS_ABSTRACT, ''' |
abstract class A { |
m(); |
} |
@@ -4191,9 +3831,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.MAKE_FIELD_NOT_FINAL, |
- ''' |
+ await assertHasFix(DartFixKind.MAKE_FIELD_NOT_FINAL, ''' |
class A { |
int fff = 1; |
main() { |
@@ -4212,9 +3850,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.MAKE_FIELD_NOT_FINAL, |
- ''' |
+ await assertHasFix(DartFixKind.MAKE_FIELD_NOT_FINAL, ''' |
class A { |
var fff = 1; |
main() { |
@@ -4243,9 +3879,7 @@ main(String p) { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.ADD_NE_NULL, |
- ''' |
+ await assertHasFix(DartFixKind.ADD_NE_NULL, ''' |
main(String p) { |
if (p != null) { |
print(p); |
@@ -4262,9 +3896,7 @@ main(int p) { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REMOVE_DEAD_CODE, |
- ''' |
+ await assertHasFix(DartFixKind.REMOVE_DEAD_CODE, ''' |
main(int p) { |
if (true) { |
print(1); |
@@ -4281,9 +3913,7 @@ int main() { |
print(1); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REMOVE_DEAD_CODE, |
- ''' |
+ await assertHasFix(DartFixKind.REMOVE_DEAD_CODE, ''' |
int main() { |
print(0); |
return 42; |
@@ -4300,9 +3930,7 @@ int main() { |
print(2); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REMOVE_DEAD_CODE, |
- ''' |
+ await assertHasFix(DartFixKind.REMOVE_DEAD_CODE, ''' |
int main() { |
print(0); |
return 42; |
@@ -4316,9 +3944,7 @@ class A { |
int get foo() => 0; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REMOVE_PARAMETERS_IN_GETTER_DECLARATION, |
- ''' |
+ await assertHasFix(DartFixKind.REMOVE_PARAMETERS_IN_GETTER_DECLARATION, ''' |
class A { |
int get foo => 0; |
} |
@@ -4334,9 +3960,7 @@ main(A a) { |
a.foo(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REMOVE_PARENTHESIS_IN_GETTER_INVOCATION, |
- ''' |
+ await assertHasFix(DartFixKind.REMOVE_PARENTHESIS_IN_GETTER_INVOCATION, ''' |
class A { |
int get foo => 0; |
} |
@@ -4354,9 +3978,7 @@ main(Object p) { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REMOVE_UNNECESSARY_CAST, |
- ''' |
+ await assertHasFix(DartFixKind.REMOVE_UNNECESSARY_CAST, ''' |
main(Object p) { |
if (p is String) { |
String v = p; |
@@ -4375,9 +3997,7 @@ main() { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REMOVE_UNUSED_CATCH_CLAUSE, |
- ''' |
+ await assertHasFix(DartFixKind.REMOVE_UNUSED_CATCH_CLAUSE, ''' |
main() { |
try { |
throw 42; |
@@ -4397,9 +4017,7 @@ main() { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REMOVE_UNUSED_CATCH_STACK, |
- ''' |
+ await assertHasFix(DartFixKind.REMOVE_UNUSED_CATCH_STACK, ''' |
main() { |
try { |
throw 42; |
@@ -4415,9 +4033,7 @@ import 'dart:math'; |
main() { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REMOVE_UNUSED_IMPORT, |
- ''' |
+ await assertHasFix(DartFixKind.REMOVE_UNUSED_IMPORT, ''' |
main() { |
} |
'''); |
@@ -4431,9 +4047,7 @@ main() { |
Future f; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REMOVE_UNUSED_IMPORT, |
- ''' |
+ await assertHasFix(DartFixKind.REMOVE_UNUSED_IMPORT, ''' |
import 'dart:async'; |
main() { |
@@ -4449,9 +4063,7 @@ import |
main() { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REMOVE_UNUSED_IMPORT, |
- ''' |
+ await assertHasFix(DartFixKind.REMOVE_UNUSED_IMPORT, ''' |
main() { |
} |
'''); |
@@ -4466,9 +4078,7 @@ class A { |
Map<String, var> m; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.REPLACE_VAR_WITH_DYNAMIC, |
- ''' |
+ await assertHasFix(DartFixKind.REPLACE_VAR_WITH_DYNAMIC, ''' |
class A { |
Map<String, dynamic> m; |
} |
@@ -4482,9 +4092,7 @@ class A { |
} |
const a = new A(); |
'''); |
- await assertHasFix( |
- DartFixKind.USE_CONST, |
- ''' |
+ await assertHasFix(DartFixKind.USE_CONST, ''' |
class A { |
const A(); |
} |
@@ -4499,9 +4107,7 @@ main() { |
c.Fture v = null; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO, ''' |
import 'dart:async' as c; |
main() { |
c.Future v = null; |
@@ -4515,9 +4121,7 @@ main() { |
Stirng s = 'abc'; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO, ''' |
main() { |
String s = 'abc'; |
} |
@@ -4531,9 +4135,7 @@ main() { |
MyCalss v = null; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO, ''' |
class MyClass {} |
main() { |
MyClass v = null; |
@@ -4547,9 +4149,7 @@ main() { |
test(throw 42); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
main() { |
test(throw 42); |
} |
@@ -4569,9 +4169,7 @@ foo(C c1, C c2) { |
bar(c1.x, c2.x); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
class C { |
int x; |
} |
@@ -4592,9 +4190,7 @@ main() { |
test(v); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
main() { |
dynamic v; |
test(v); |
@@ -4611,9 +4207,7 @@ main() { |
dynamic v = test(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
main() { |
dynamic v = test(); |
} |
@@ -4629,9 +4223,7 @@ main() { |
int v = myUndefinedFunction(1, 2.0, '3'); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
main() { |
int v = myUndefinedFunction(1, 2.0, '3'); |
} |
@@ -4649,9 +4241,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
class A { |
main() { |
int v = myUndefinedFunction(1, 2.0, '3'); |
@@ -4672,9 +4262,7 @@ class A<T> { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
class A<T> { |
Map<int, T> items; |
main() { |
@@ -4696,9 +4284,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
class A { |
List<int> items; |
main() { |
@@ -4717,9 +4303,7 @@ void process(List<int> items) { |
} |
test_undefinedFunction_create_importType() async { |
- addSource( |
- '/lib.dart', |
- r''' |
+ addSource('/lib.dart', r''' |
library lib; |
import 'dart:async'; |
Future getFuture() => null; |
@@ -4730,9 +4314,7 @@ main() { |
test(getFuture()); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
import 'dart:async'; |
import 'lib.dart'; |
@@ -4751,9 +4333,7 @@ main() { |
test(null); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
main() { |
test(null); |
} |
@@ -4787,9 +4367,7 @@ main() { |
v = myUndefinedFunction(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
main() { |
int v; |
v = myUndefinedFunction(); |
@@ -4807,9 +4385,7 @@ main() { |
v += myUndefinedFunction(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
main() { |
int v; |
v += myUndefinedFunction(); |
@@ -4826,9 +4402,7 @@ main() { |
0 + myUndefinedFunction(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
main() { |
0 + myUndefinedFunction(); |
} |
@@ -4844,9 +4418,7 @@ main() { |
int v = myUndefinedFunction(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
main() { |
int v = myUndefinedFunction(); |
} |
@@ -4863,9 +4435,7 @@ main() { |
foo( myUndefinedFunction() ); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
foo(int p) {} |
main() { |
foo( myUndefinedFunction() ); |
@@ -4882,9 +4452,7 @@ int main() { |
return myUndefinedFunction(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
int main() { |
return myUndefinedFunction(); |
} |
@@ -4900,9 +4468,7 @@ main() { |
myUndefinedFunction(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_FUNCTION, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_FUNCTION, ''' |
main() { |
myUndefinedFunction(); |
} |
@@ -4918,9 +4484,7 @@ main() { |
pritn(0); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO, ''' |
main() { |
print(0); |
} |
@@ -4934,9 +4498,7 @@ main() { |
c.prnt(42); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO, ''' |
import 'dart:core' as c; |
main() { |
c.print(42); |
@@ -4961,9 +4523,7 @@ main() { |
myFuntcion(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO, ''' |
myFunction() {} |
main() { |
myFunction(); |
@@ -4981,9 +4541,7 @@ main(A a) { |
print(x.myFild); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO, ''' |
class A { |
int myField; |
} |
@@ -5003,9 +4561,7 @@ main(A a) { |
print(a.myFild); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO, ''' |
class A { |
int myField; |
} |
@@ -5024,9 +4580,7 @@ main() { |
A.MY_NAM; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO, ''' |
class A { |
static int MY_NAME = 1; |
} |
@@ -5045,9 +4599,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO, ''' |
class A { |
int myField; |
main() { |
@@ -5089,9 +4641,7 @@ class A<T> { |
class B { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
class A<T> { |
B b; |
Map<int, T> items; |
@@ -5117,9 +4667,7 @@ class A<T> { |
class B { |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
class A<T> { |
main() { |
T t = new B().compute(); |
@@ -5144,9 +4692,7 @@ class A { |
class B {} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
class A { |
B b; |
List<int> items; |
@@ -5170,9 +4716,7 @@ class A<T> { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
class A<T> { |
List<T> items; |
main() { |
@@ -5191,9 +4735,7 @@ main() { |
A.myUndefinedMethod(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
class A { |
static void myUndefinedMethod() {} |
} |
@@ -5211,9 +4753,7 @@ main() { |
A.myUndefinedMethod(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
class A { |
static void myUndefinedMethod() {} |
} |
@@ -5232,9 +4772,7 @@ main() { |
A.myUndefinedMethod(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
class A { |
foo() {} |
@@ -5254,9 +4792,7 @@ main(A a) { |
a.myUndefinedMethod(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
class A { |
void myUndefinedMethod() {} |
} |
@@ -5296,9 +4832,7 @@ class D { |
bar(c1.x, c2.x); |
} |
}'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
class C { |
int x; |
} |
@@ -5320,9 +4854,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
class A { |
main() { |
myUndefinedMethod(0, 1.0, '3'); |
@@ -5365,9 +4897,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
class A { |
main() { |
myUndefinedMethod(0, bbb: 1.0, ccc: '2'); |
@@ -5408,9 +4938,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
class A { |
main() { |
int v = myUndefinedMethod(); |
@@ -5431,9 +4959,7 @@ class A { |
static var f = myUndefinedMethod(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
class A { |
static var f = myUndefinedMethod(); |
@@ -5450,9 +4976,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
class A { |
static main() { |
myUndefinedMethod(); |
@@ -5472,9 +4996,7 @@ main() { |
a.myUndefinedMethod(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CREATE_METHOD, |
- ''' |
+ await assertHasFix(DartFixKind.CREATE_METHOD, ''' |
class A { |
void myUndefinedMethod() {} |
} |
@@ -5494,9 +5016,7 @@ class D { |
} |
'''; |
addSource('/test2.dart', code2); |
- addSource( |
- '/test3.dart', |
- r''' |
+ addSource('/test3.dart', r''' |
library test3; |
class E {} |
'''); |
@@ -5515,9 +5035,7 @@ main(aaa.D d, aaa.E e) { |
expect(fileEdits, hasLength(1)); |
SourceFileEdit fileEdit = change.edits[0]; |
expect(fileEdit.file, '/test2.dart'); |
- expect( |
- SourceEdit.applySequence(code2, fileEdit.edits), |
- r''' |
+ expect(SourceEdit.applySequence(code2, fileEdit.edits), r''' |
library test2; |
import 'test3.dart' as bbb; |
export 'test3.dart'; |
@@ -5550,9 +5068,7 @@ main(test2.D d, test2.E e) { |
expect(fileEdits, hasLength(1)); |
SourceFileEdit fileEdit = change.edits[0]; |
expect(fileEdit.file, '/test2.dart'); |
- expect( |
- SourceEdit.applySequence(code2, fileEdit.edits), |
- r''' |
+ expect(SourceEdit.applySequence(code2, fileEdit.edits), r''' |
library test2; |
class D { |
void foo(E e) {} |
@@ -5580,9 +5096,7 @@ main() { |
a.myMehtod(); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO, ''' |
class A { |
myMethod() {} |
} |
@@ -5604,9 +5118,7 @@ class B extends A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO, ''' |
class A { |
myMethod() {} |
} |
@@ -5627,9 +5139,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO, ''' |
class A { |
myMethod() {} |
main() { |
@@ -5678,9 +5188,7 @@ build() { |
); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CONVERT_FLUTTER_CHILD, |
- ''' |
+ await assertHasFix(DartFixKind.CONVERT_FLUTTER_CHILD, ''' |
import 'package:flutter/src/widgets/framework.dart'; |
build() { |
return new Container( |
@@ -5714,9 +5222,7 @@ build() { |
); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CONVERT_FLUTTER_CHILD, |
- ''' |
+ await assertHasFix(DartFixKind.CONVERT_FLUTTER_CHILD, ''' |
import 'package:flutter/src/widgets/framework.dart'; |
build() { |
return new Container( |
@@ -5749,9 +5255,7 @@ build() { |
); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CONVERT_FLUTTER_CHILD, |
- ''' |
+ await assertHasFix(DartFixKind.CONVERT_FLUTTER_CHILD, ''' |
import 'package:flutter/src/widgets/framework.dart'; |
build() { |
return new Scaffold( |
@@ -5778,9 +5282,7 @@ main(A a) { |
x.myFild = 42; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO, ''' |
class A { |
int myField; |
} |
@@ -5800,9 +5302,7 @@ main(A a) { |
a.myFild = 42; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO, ''' |
class A { |
int myField; |
} |
@@ -5821,9 +5321,7 @@ class A { |
} |
} |
'''); |
- await assertHasFix( |
- DartFixKind.CHANGE_TO, |
- ''' |
+ await assertHasFix(DartFixKind.CHANGE_TO, ''' |
class A { |
int myField; |
main() { |
@@ -5841,9 +5339,7 @@ main() { |
print((a / b).toInt()); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.USE_EFFECTIVE_INTEGER_DIVISION, |
- ''' |
+ await assertHasFix(DartFixKind.USE_EFFECTIVE_INTEGER_DIVISION, ''' |
main() { |
var a = 5; |
var b = 2; |
@@ -5860,9 +5356,7 @@ main() { |
Future f = null; |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PREFIX, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PREFIX, ''' |
import 'dart:async' as pref; |
main() { |
pref.Stream s = null; |
@@ -5879,9 +5373,7 @@ main() { |
print(PI); |
} |
'''); |
- await assertHasFix( |
- DartFixKind.IMPORT_LIBRARY_PREFIX, |
- ''' |
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PREFIX, ''' |
import 'dart:math' as pref; |
main() { |
print(pref.E); |
@@ -5891,10 +5383,7 @@ main() { |
} |
void _addMetaPackageSource() { |
- addPackageSource( |
- 'meta', |
- 'meta.dart', |
- r''' |
+ addPackageSource('meta', 'meta.dart', r''' |
library meta; |
const Required required = const Required(); |