Index: pkg/analyzer/test/generated/static_warning_code_test.dart |
diff --git a/pkg/analyzer/test/generated/static_warning_code_test.dart b/pkg/analyzer/test/generated/static_warning_code_test.dart |
index c5bede5ae568ad66ac368196655a47e07d145f44..a5b0555a77ec42eb42ee3778c8a7a59f2110fd4f 100644 |
--- a/pkg/analyzer/test/generated/static_warning_code_test.dart |
+++ b/pkg/analyzer/test/generated/static_warning_code_test.dart |
@@ -9,10 +9,11 @@ import 'package:analyzer/src/generated/source_io.dart'; |
import 'package:unittest/unittest.dart'; |
import '../reflective_tests.dart'; |
+import '../utils.dart'; |
import 'resolver_test.dart'; |
main() { |
- groupSep = ' | '; |
+ initializeTestEnvironment(); |
runReflectiveTests(StaticWarningCodeTest); |
} |
@@ -54,10 +55,14 @@ f(var p) { |
import 'lib1.dart'; |
import 'lib2.dart'; |
f(p) {p as N;}'''); |
- addNamedSource("/lib1.dart", r''' |
+ addNamedSource( |
+ "/lib1.dart", |
+ r''' |
library lib1; |
class N {}'''); |
- addNamedSource("/lib2.dart", r''' |
+ addNamedSource( |
+ "/lib2.dart", |
+ r''' |
library lib2; |
class N {}'''); |
computeLibrarySourceErrors(source); |
@@ -69,10 +74,14 @@ class N {}'''); |
import 'lib1.dart'; |
import 'lib2.dart'; |
class A extends N {}'''); |
- addNamedSource("/lib1.dart", r''' |
+ addNamedSource( |
+ "/lib1.dart", |
+ r''' |
library lib1; |
class N {}'''); |
- addNamedSource("/lib2.dart", r''' |
+ addNamedSource( |
+ "/lib2.dart", |
+ r''' |
library lib2; |
class N {}'''); |
computeLibrarySourceErrors(source); |
@@ -87,10 +96,14 @@ class N {}'''); |
import 'lib1.dart'; |
import 'lib2.dart'; |
class A implements N {}'''); |
- addNamedSource("/lib1.dart", r''' |
+ addNamedSource( |
+ "/lib1.dart", |
+ r''' |
library lib1; |
class N {}'''); |
- addNamedSource("/lib2.dart", r''' |
+ addNamedSource( |
+ "/lib2.dart", |
+ r''' |
library lib2; |
class N {}'''); |
computeLibrarySourceErrors(source); |
@@ -106,13 +119,19 @@ library lib; |
import 'lib1.dart'; |
import 'lib2.dart'; |
part 'part.dart';'''); |
- addNamedSource("/lib1.dart", r''' |
+ addNamedSource( |
+ "/lib1.dart", |
+ r''' |
library lib1; |
class N {}'''); |
- addNamedSource("/lib2.dart", r''' |
+ addNamedSource( |
+ "/lib2.dart", |
+ r''' |
library lib2; |
class N {}'''); |
- Source partSource = addNamedSource("/part.dart", r''' |
+ Source partSource = addNamedSource( |
+ "/part.dart", |
+ r''' |
part of lib; |
class A extends N {}'''); |
computeLibrarySourceErrors(source); |
@@ -128,10 +147,14 @@ library L; |
import 'lib1.dart'; |
import 'lib2.dart'; |
f() {new N();}'''); |
- addNamedSource("/lib1.dart", r''' |
+ addNamedSource( |
+ "/lib1.dart", |
+ r''' |
library lib1; |
class N {}'''); |
- addNamedSource("/lib2.dart", r''' |
+ addNamedSource( |
+ "/lib2.dart", |
+ r''' |
library lib2; |
class N {}'''); |
computeLibrarySourceErrors(source); |
@@ -143,10 +166,14 @@ class N {}'''); |
import 'lib1.dart'; |
import 'lib2.dart'; |
f(p) {p is N;}'''); |
- addNamedSource("/lib1.dart", r''' |
+ addNamedSource( |
+ "/lib1.dart", |
+ r''' |
library lib1; |
class N {}'''); |
- addNamedSource("/lib2.dart", r''' |
+ addNamedSource( |
+ "/lib2.dart", |
+ r''' |
library lib2; |
class N {}'''); |
computeLibrarySourceErrors(source); |
@@ -158,10 +185,14 @@ class N {}'''); |
import 'lib1.dart'; |
import 'lib2.dart'; |
g() { N.FOO; }'''); |
- addNamedSource("/lib1.dart", r''' |
+ addNamedSource( |
+ "/lib1.dart", |
+ r''' |
library lib1; |
class N {}'''); |
- addNamedSource("/lib2.dart", r''' |
+ addNamedSource( |
+ "/lib2.dart", |
+ r''' |
library lib2; |
class N {}'''); |
computeLibrarySourceErrors(source); |
@@ -181,10 +212,14 @@ class A { |
N m() { return null; } |
} |
class B<T extends N> {}'''); |
- addNamedSource("/lib1.dart", r''' |
+ addNamedSource( |
+ "/lib1.dart", |
+ r''' |
library lib1; |
class N {}'''); |
- addNamedSource("/lib2.dart", r''' |
+ addNamedSource( |
+ "/lib2.dart", |
+ r''' |
library lib2; |
class N {}'''); |
computeLibrarySourceErrors(source); |
@@ -205,10 +240,14 @@ import 'lib1.dart'; |
import 'lib2.dart'; |
class A<T> {} |
A<N> f() { return null; }'''); |
- addNamedSource("/lib1.dart", r''' |
+ addNamedSource( |
+ "/lib1.dart", |
+ r''' |
library lib1; |
class N {}'''); |
- addNamedSource("/lib2.dart", r''' |
+ addNamedSource( |
+ "/lib2.dart", |
+ r''' |
library lib2; |
class N {}'''); |
computeLibrarySourceErrors(source); |
@@ -221,10 +260,14 @@ import 'lib1.dart'; |
import 'lib2.dart'; |
class A<T> {} |
f() {new A<N>();}'''); |
- addNamedSource("/lib1.dart", r''' |
+ addNamedSource( |
+ "/lib1.dart", |
+ r''' |
library lib1; |
class N {}'''); |
- addNamedSource("/lib2.dart", r''' |
+ addNamedSource( |
+ "/lib2.dart", |
+ r''' |
library lib2; |
class N {}'''); |
computeLibrarySourceErrors(source); |
@@ -237,10 +280,14 @@ import 'lib1.dart'; |
import 'lib2.dart'; |
f() { g(v); } |
g(p) {}'''); |
- addNamedSource("/lib1.dart", r''' |
+ addNamedSource( |
+ "/lib1.dart", |
+ r''' |
library lib1; |
var v;'''); |
- addNamedSource("/lib2.dart", r''' |
+ addNamedSource( |
+ "/lib2.dart", |
+ r''' |
library lib2; |
var v;'''); |
computeLibrarySourceErrors(source); |
@@ -252,10 +299,14 @@ var v;'''); |
import 'lib1.dart'; |
import 'lib2.dart'; |
f() { v = 0; }'''); |
- addNamedSource("/lib1.dart", r''' |
+ addNamedSource( |
+ "/lib1.dart", |
+ r''' |
library lib1; |
var v;'''); |
- addNamedSource("/lib2.dart", r''' |
+ addNamedSource( |
+ "/lib2.dart", |
+ r''' |
library lib2; |
var v;'''); |
computeLibrarySourceErrors(source); |
@@ -270,10 +321,14 @@ import 'lib2.dart' as p; |
main() { |
p.f(); |
}'''); |
- addNamedSource("/lib1.dart", r''' |
+ addNamedSource( |
+ "/lib1.dart", |
+ r''' |
library lib1; |
f() {}'''); |
- addNamedSource("/lib2.dart", r''' |
+ addNamedSource( |
+ "/lib2.dart", |
+ r''' |
library lib2; |
f() {}'''); |
computeLibrarySourceErrors(source); |
@@ -282,14 +337,18 @@ f() {}'''); |
void test_argumentTypeNotAssignable_ambiguousClassName() { |
// See dartbug.com/19624 |
- Source source = addNamedSource("/lib1.dart", r''' |
+ Source source = addNamedSource( |
+ "/lib1.dart", |
+ r''' |
library lib1; |
import 'lib2.dart'; |
class _A {} |
f() { |
g((_A a) {}); |
}'''); |
- addNamedSource("/lib2.dart", r''' |
+ addNamedSource( |
+ "/lib2.dart", |
+ r''' |
library lib2; |
class _A {} |
g(h(_A a)) {}'''); |
@@ -911,7 +970,9 @@ import 'lib.dart'; |
import 'dart:async'; |
Future f = null; |
Stream s;'''); |
- addNamedSource("/lib.dart", r''' |
+ addNamedSource( |
+ "/lib.dart", |
+ r''' |
library lib; |
class Future {}'''); |
computeLibrarySourceErrors(source); |
@@ -1452,7 +1513,9 @@ class A {}''', |
library lib; |
import 'lib1.dart' deferred as p; |
var a = new p.A();''' |
- ], <ErrorCode>[StaticWarningCode.IMPORT_OF_NON_LIBRARY]); |
+ ], <ErrorCode>[ |
+ StaticWarningCode.IMPORT_OF_NON_LIBRARY |
+ ]); |
} |
void test_inconsistentMethodInheritanceGetterAndMethod() { |
@@ -2380,8 +2443,10 @@ void f() { |
} |
void test_newWithNonType_fromLibrary() { |
- Source source1 = addNamedSource("lib.dart", "class B {}"); |
- Source source2 = addNamedSource("lib2.dart", r''' |
+ Source source1 = addNamedSource("/lib.dart", "class B {}"); |
+ Source source2 = addNamedSource( |
+ "/lib2.dart", |
+ r''' |
import 'lib.dart' as lib; |
void f() { |
var a = new lib.A(); |
@@ -3067,7 +3132,9 @@ import 'lib1.dart' deferred as a; |
f(var v) { |
v as a.A; |
}''' |
- ], <ErrorCode>[StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS]); |
+ ], <ErrorCode>[ |
+ StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS |
+ ]); |
} |
void test_typeAnnotationDeferredClass_catchClause() { |
@@ -3083,7 +3150,9 @@ f(var v) { |
} on a.A { |
} |
}''' |
- ], <ErrorCode>[StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS]); |
+ ], <ErrorCode>[ |
+ StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS |
+ ]); |
} |
void test_typeAnnotationDeferredClass_fieldFormalParameter() { |
@@ -3098,7 +3167,9 @@ class C { |
var v; |
C(a.A this.v); |
}''' |
- ], <ErrorCode>[StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS]); |
+ ], <ErrorCode>[ |
+ StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS |
+ ]); |
} |
void test_typeAnnotationDeferredClass_functionDeclaration_returnType() { |
@@ -3110,7 +3181,9 @@ class A {}''', |
library root; |
import 'lib1.dart' deferred as a; |
a.A f() { return null; }''' |
- ], <ErrorCode>[StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS]); |
+ ], <ErrorCode>[ |
+ StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS |
+ ]); |
} |
void test_typeAnnotationDeferredClass_functionTypedFormalParameter_returnType() { |
@@ -3122,7 +3195,9 @@ class A {}''', |
library root; |
import 'lib1.dart' deferred as a; |
f(a.A g()) {}''' |
- ], <ErrorCode>[StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS]); |
+ ], <ErrorCode>[ |
+ StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS |
+ ]); |
} |
void test_typeAnnotationDeferredClass_isExpression() { |
@@ -3136,7 +3211,9 @@ import 'lib1.dart' deferred as a; |
f(var v) { |
bool b = v is a.A; |
}''' |
- ], <ErrorCode>[StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS]); |
+ ], <ErrorCode>[ |
+ StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS |
+ ]); |
} |
void test_typeAnnotationDeferredClass_methodDeclaration_returnType() { |
@@ -3150,7 +3227,9 @@ import 'lib1.dart' deferred as a; |
class C { |
a.A m() { return null; } |
}''' |
- ], <ErrorCode>[StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS]); |
+ ], <ErrorCode>[ |
+ StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS |
+ ]); |
} |
void test_typeAnnotationDeferredClass_simpleFormalParameter() { |
@@ -3162,7 +3241,9 @@ class A {}''', |
library root; |
import 'lib1.dart' deferred as a; |
f(a.A v) {}''' |
- ], <ErrorCode>[StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS]); |
+ ], <ErrorCode>[ |
+ StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS |
+ ]); |
} |
void test_typeAnnotationDeferredClass_typeArgumentList() { |
@@ -3175,7 +3256,9 @@ library root; |
import 'lib1.dart' deferred as a; |
class C<E> {} |
C<a.A> c;''' |
- ], <ErrorCode>[StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS]); |
+ ], <ErrorCode>[ |
+ StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS |
+ ]); |
} |
void test_typeAnnotationDeferredClass_typeArgumentList2() { |
@@ -3203,7 +3286,9 @@ class A {}''', |
library root; |
import 'lib1.dart' deferred as a; |
class C<E extends a.A> {}''' |
- ], <ErrorCode>[StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS]); |
+ ], <ErrorCode>[ |
+ StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS |
+ ]); |
} |
void test_typeAnnotationDeferredClass_variableDeclarationList() { |
@@ -3215,7 +3300,9 @@ class A {}''', |
library root; |
import 'lib1.dart' deferred as a; |
a.A v;''' |
- ], <ErrorCode>[StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS]); |
+ ], <ErrorCode>[ |
+ StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS |
+ ]); |
} |
void test_typeParameterReferencedByStatic_field() { |
@@ -3343,8 +3430,10 @@ f(var p) { |
} |
void test_undefinedGetter_fromLibrary() { |
- Source source1 = addNamedSource("lib.dart", ""); |
- Source source2 = addNamedSource("lib2.dart", r''' |
+ Source source1 = addNamedSource("/lib.dart", ""); |
+ Source source2 = addNamedSource( |
+ "/lib2.dart", |
+ r''' |
import 'lib.dart' as lib; |
void f() { |
var g = lib.gg; |
@@ -3395,7 +3484,9 @@ main() { |
} |
void test_undefinedIdentifier_private_getter() { |
- addNamedSource("/lib.dart", r''' |
+ addNamedSource( |
+ "/lib.dart", |
+ r''' |
library lib; |
class A { |
var _foo; |
@@ -3412,7 +3503,9 @@ class B extends A { |
} |
void test_undefinedIdentifier_private_setter() { |
- addNamedSource("/lib.dart", r''' |
+ addNamedSource( |
+ "/lib.dart", |
+ r''' |
library lib; |
class A { |
var _foo; |
@@ -3440,8 +3533,10 @@ main() { |
} |
void test_undefinedSetter() { |
- Source source1 = addNamedSource("lib.dart", ""); |
- Source source2 = addNamedSource("lib2.dart", r''' |
+ Source source1 = addNamedSource("/lib.dart", ""); |
+ Source source2 = addNamedSource( |
+ "/lib2.dart", |
+ r''' |
import 'lib.dart' as lib; |
void f() { |
lib.gg = null; |