Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1141)

Unified Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 1185443002: Support for parsing HTML in the new task model (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/src/task/dart_test.dart
diff --git a/pkg/analyzer/test/src/task/dart_test.dart b/pkg/analyzer/test/src/task/dart_test.dart
index 9ebd8b9947864a074a7a26847b5429e189f51e1f..29ccfee3da5aeb6b6e2bdd465d4e6dd2f233030f 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -68,14 +68,14 @@ class C extends B with M {}
''');
LibraryElement libraryElement;
{
- _computeResult(source, LIBRARY_ELEMENT5);
+ computeResult(source, LIBRARY_ELEMENT5);
libraryElement = outputs[LIBRARY_ELEMENT5];
}
// prepare C
ClassElement c = libraryElement.getType('C');
expect(c, isNotNull);
// build constructors
- _computeResult(c, CONSTRUCTORS);
+ computeResult(c, CONSTRUCTORS);
expect(task, new isInstanceOf<BuildClassConstructorsTask>());
_fillErrorListener(CONSTRUCTORS_ERRORS);
errorListener.assertErrorsWithCodes(
@@ -93,14 +93,14 @@ class C extends B {
''');
LibraryElement libraryElement;
{
- _computeResult(source, LIBRARY_ELEMENT5);
+ computeResult(source, LIBRARY_ELEMENT5);
libraryElement = outputs[LIBRARY_ELEMENT5];
}
// prepare C
ClassElement c = libraryElement.getType('C');
expect(c, isNotNull);
// build constructors
- _computeResult(c, CONSTRUCTORS);
+ computeResult(c, CONSTRUCTORS);
expect(task, new isInstanceOf<BuildClassConstructorsTask>());
// no errors
expect(outputs[CONSTRUCTORS_ERRORS], isEmpty);
@@ -123,14 +123,14 @@ class C1 = B with M1;
''');
LibraryElement libraryElement;
{
- _computeResult(source, LIBRARY_ELEMENT5);
+ computeResult(source, LIBRARY_ELEMENT5);
libraryElement = outputs[LIBRARY_ELEMENT5];
}
// prepare C2
ClassElement class2 = libraryElement.getType('C2');
expect(class2, isNotNull);
// build constructors
- _computeResult(class2, CONSTRUCTORS);
+ computeResult(class2, CONSTRUCTORS);
expect(task, new isInstanceOf<BuildClassConstructorsTask>());
List<ConstructorElement> constructors = outputs[CONSTRUCTORS];
expect(constructors, hasLength(1));
@@ -147,14 +147,14 @@ class C = B with M;
''');
LibraryElement libraryElement;
{
- _computeResult(source, LIBRARY_ELEMENT5);
+ computeResult(source, LIBRARY_ELEMENT5);
libraryElement = outputs[LIBRARY_ELEMENT5];
}
// prepare C
ClassElement c = libraryElement.getType('C');
expect(c, isNotNull);
// build constructors
- _computeResult(c, CONSTRUCTORS);
+ computeResult(c, CONSTRUCTORS);
expect(task, new isInstanceOf<BuildClassConstructorsTask>());
_fillErrorListener(CONSTRUCTORS_ERRORS);
errorListener.assertErrorsWithCodes(
@@ -262,7 +262,7 @@ class B = Object with A;
CacheEntry cacheEntry = analysisCache.get(target);
cacheEntry.setState(RESOLVED_UNIT1, CacheState.INVALID);
// compute again
- _computeResult(target, RESOLVED_UNIT1);
+ computeResult(target, RESOLVED_UNIT1);
expect(outputs[COMPILATION_UNIT_ELEMENT], same(unitElement));
expect(outputs[RESOLVED_UNIT1], isNot(same(unit)));
}
@@ -270,7 +270,7 @@ class B = Object with A;
void _performBuildTask(String content) {
source = newSource('/test.dart', content);
target = new LibrarySpecificUnit(source, source);
- _computeResult(target, RESOLVED_UNIT1);
+ computeResult(target, RESOLVED_UNIT1);
expect(task, new isInstanceOf<BuildCompilationUnitElementTask>());
}
}
@@ -322,7 +322,7 @@ library libC;
Source sourceB = sources[1];
Source sourceC = sources[2];
// perform task
- _computeResult(sourceA, LIBRARY_ELEMENT2);
+ computeResult(sourceA, LIBRARY_ELEMENT2);
expect(task, new isInstanceOf<BuildDirectiveElementsTask>());
// prepare outputs
LibraryElement libraryElementA = outputs[LIBRARY_ELEMENT2];
@@ -375,7 +375,7 @@ library libB;
});
Source sourceA = sources[0];
// perform task
- _computeResult(sourceA, LIBRARY_ELEMENT2);
+ computeResult(sourceA, LIBRARY_ELEMENT2);
expect(task, new isInstanceOf<BuildDirectiveElementsTask>());
// prepare outputs
CompilationUnit libraryUnitA = context
@@ -404,7 +404,7 @@ library libB;
List<Source> sources = newSources({'/libA.dart': ''});
Source source = sources[0];
// perform task
- _computeResult(source, LIBRARY_ELEMENT2);
+ computeResult(source, LIBRARY_ELEMENT2);
expect(task, new isInstanceOf<BuildDirectiveElementsTask>());
// prepare outputs
LibraryElement libraryElement = outputs[LIBRARY_ELEMENT2];
@@ -428,7 +428,7 @@ part of notLib;
});
Source sourceA = sources[0];
// perform task
- _computeResult(sourceA, LIBRARY_ELEMENT2);
+ computeResult(sourceA, LIBRARY_ELEMENT2);
expect(task, new isInstanceOf<BuildDirectiveElementsTask>());
// validate errors
_assertErrorsWithCodes([CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY]);
@@ -446,7 +446,7 @@ part of notLib;
});
Source sourceA = sources[0];
// perform task
- _computeResult(sourceA, LIBRARY_ELEMENT2);
+ computeResult(sourceA, LIBRARY_ELEMENT2);
expect(task, new isInstanceOf<BuildDirectiveElementsTask>());
// validate errors
_assertErrorsWithCodes([CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]);
@@ -460,7 +460,7 @@ import 'dart-ext:doesNotExist.dart';
});
Source source = sources[0];
// perform task
- _computeResult(source, LIBRARY_ELEMENT2);
+ computeResult(source, LIBRARY_ELEMENT2);
expect(task, new isInstanceOf<BuildDirectiveElementsTask>());
// prepare outputs
LibraryElement libraryElement = outputs[LIBRARY_ELEMENT2];
@@ -484,7 +484,7 @@ library libC;
Source sourceA = sources[0];
Source sourceB = sources[1];
// perform task
- _computeResult(sourceA, LIBRARY_ELEMENT2);
+ computeResult(sourceA, LIBRARY_ELEMENT2);
expect(task, new isInstanceOf<BuildDirectiveElementsTask>());
// prepare outputs
CompilationUnit libraryUnitA = context
@@ -534,7 +534,7 @@ enum MyEnum {
A, B
}
''');
- _computeResult(new LibrarySpecificUnit(source, source), RESOLVED_UNIT2);
+ computeResult(new LibrarySpecificUnit(source, source), RESOLVED_UNIT2);
expect(task, new isInstanceOf<BuildEnumMemberElementsTask>());
CompilationUnit unit = outputs[RESOLVED_UNIT2];
// validate Element
@@ -599,7 +599,7 @@ export 'b.dart';
library lib_b;
main() {}
''');
- _computeResult(sourceA, LIBRARY_ELEMENT4);
+ computeResult(sourceA, LIBRARY_ELEMENT4);
expect(task, new isInstanceOf<BuildExportNamespaceTask>());
// validate
{
@@ -631,7 +631,7 @@ class C1 {}
class C2 {}
class C3 {}
''');
- _computeResult(sourceA, LIBRARY_ELEMENT4);
+ computeResult(sourceA, LIBRARY_ELEMENT4);
expect(task, new isInstanceOf<BuildExportNamespaceTask>());
// validate
{
@@ -656,7 +656,7 @@ class B1 {}
class B2 {}
class _B3 {}
''');
- _computeResult(sourceA, LIBRARY_ELEMENT4);
+ computeResult(sourceA, LIBRARY_ELEMENT4);
expect(task, new isInstanceOf<BuildExportNamespaceTask>());
// validate
{
@@ -677,7 +677,7 @@ class A {}
library lib_b;
int topLevelB;
''');
- _computeResult(sourceA, LIBRARY_ELEMENT4);
+ computeResult(sourceA, LIBRARY_ELEMENT4);
expect(task, new isInstanceOf<BuildExportNamespaceTask>());
// validate
{
@@ -697,7 +697,7 @@ typedef int F(G g);
typedef String G(int p);
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, RESOLVED_UNIT3);
+ computeResult(target, RESOLVED_UNIT3);
expect(task, new isInstanceOf<BuildFunctionTypeAliasesTask>());
// validate
CompilationUnit unit = outputs[RESOLVED_UNIT3];
@@ -723,7 +723,7 @@ typedef String G(int p);
typedef int F(NoSuchType p);
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, BUILD_FUNCTION_TYPE_ALIASES_ERRORS);
+ computeResult(target, BUILD_FUNCTION_TYPE_ALIASES_ERRORS);
expect(task, new isInstanceOf<BuildFunctionTypeAliasesTask>());
// validate
_fillErrorListener(BUILD_FUNCTION_TYPE_ALIASES_ERRORS);
@@ -746,7 +746,7 @@ class C2 = C1 with M2;
class C1 = B with M1;
class C3 = B with M2;
''');
- _computeResult(source, LIBRARY_ELEMENT6);
+ computeResult(source, LIBRARY_ELEMENT6);
expect(task, new isInstanceOf<BuildLibraryConstructorsTask>());
LibraryElement libraryElement = outputs[LIBRARY_ELEMENT6];
// C1
@@ -1044,7 +1044,7 @@ void set test(_) {}
void _performBuildTask(Map<String, String> sourceMap) {
List<Source> sources = newSources(sourceMap);
Source libSource = sources.first;
- _computeResult(libSource, LIBRARY_ELEMENT1);
+ computeResult(libSource, LIBRARY_ELEMENT1);
expect(task, new isInstanceOf<BuildLibraryElementTask>());
libraryUnit = context
.getCacheEntry(new LibrarySpecificUnit(libSource, libSource))
@@ -1107,7 +1107,7 @@ _c() {}
d() {}
'''
});
- _computeResult(sources.first, LIBRARY_ELEMENT3);
+ computeResult(sources.first, LIBRARY_ELEMENT3);
expect(task, new isInstanceOf<BuildPublicNamespaceTask>());
// validate
LibraryElement library = outputs[LIBRARY_ELEMENT3];
@@ -1136,21 +1136,21 @@ library lib_d;
''');
// a.dart
{
- _computeResult(sourceA, EXPORT_SOURCE_CLOSURE);
+ computeResult(sourceA, EXPORT_SOURCE_CLOSURE);
expect(task, new isInstanceOf<BuildSourceClosuresTask>());
List<Source> closure = outputs[EXPORT_SOURCE_CLOSURE];
expect(closure, unorderedEquals([sourceA, sourceB, sourceC]));
}
// c.dart
{
- _computeResult(sourceC, EXPORT_SOURCE_CLOSURE);
+ computeResult(sourceC, EXPORT_SOURCE_CLOSURE);
expect(task, new isInstanceOf<BuildSourceClosuresTask>());
List<Source> closure = outputs[EXPORT_SOURCE_CLOSURE];
expect(closure, unorderedEquals([sourceA, sourceB, sourceC]));
}
// d.dart
{
- _computeResult(sourceD, EXPORT_SOURCE_CLOSURE);
+ computeResult(sourceD, EXPORT_SOURCE_CLOSURE);
expect(task, new isInstanceOf<BuildSourceClosuresTask>());
List<Source> closure = outputs[EXPORT_SOURCE_CLOSURE];
expect(closure, unorderedEquals([sourceD]));
@@ -1176,7 +1176,7 @@ library lib_d;
Source coreSource = context.sourceFactory.resolveUri(null, 'dart:core');
// a.dart
{
- _computeResult(sourceA, IMPORT_SOURCE_CLOSURE);
+ computeResult(sourceA, IMPORT_SOURCE_CLOSURE);
expect(task, new isInstanceOf<BuildSourceClosuresTask>());
List<Source> closure = outputs[IMPORT_SOURCE_CLOSURE];
expect(closure, contains(sourceA));
@@ -1186,7 +1186,7 @@ library lib_d;
}
// c.dart
{
- _computeResult(sourceC, IMPORT_SOURCE_CLOSURE);
+ computeResult(sourceC, IMPORT_SOURCE_CLOSURE);
expect(task, new isInstanceOf<BuildSourceClosuresTask>());
List<Source> closure = outputs[IMPORT_SOURCE_CLOSURE];
expect(closure, contains(sourceA));
@@ -1196,7 +1196,7 @@ library lib_d;
}
// d.dart
{
- _computeResult(sourceD, IMPORT_SOURCE_CLOSURE);
+ computeResult(sourceD, IMPORT_SOURCE_CLOSURE);
expect(task, new isInstanceOf<BuildSourceClosuresTask>());
List<Source> closure = outputs[IMPORT_SOURCE_CLOSURE];
expect(closure, contains(sourceD));
@@ -1219,7 +1219,7 @@ import 'b.dart';
Source coreSource = context.sourceFactory.resolveUri(null, 'dart:core');
// c.dart
{
- _computeResult(sourceC, IMPORT_EXPORT_SOURCE_CLOSURE);
+ computeResult(sourceC, IMPORT_EXPORT_SOURCE_CLOSURE);
expect(task, new isInstanceOf<BuildSourceClosuresTask>());
List<Source> closure = outputs[IMPORT_EXPORT_SOURCE_CLOSURE];
expect(closure, contains(sourceA));
@@ -1229,7 +1229,7 @@ import 'b.dart';
}
// b.dart
{
- _computeResult(sourceB, IMPORT_EXPORT_SOURCE_CLOSURE);
+ computeResult(sourceB, IMPORT_EXPORT_SOURCE_CLOSURE);
expect(task, new isInstanceOf<BuildSourceClosuresTask>());
List<Source> closure = outputs[IMPORT_EXPORT_SOURCE_CLOSURE];
expect(closure, contains(sourceA));
@@ -1246,7 +1246,7 @@ import 'b.dart';
newSource('/b.dart', '''
library lib_b;
''');
- _computeResult(sourceA, IS_CLIENT);
+ computeResult(sourceA, IS_CLIENT);
expect(task, new isInstanceOf<BuildSourceClosuresTask>());
expect(outputs[IS_CLIENT], isFalse);
}
@@ -1259,7 +1259,7 @@ export 'dart:html';
Source source = newSource('/test.dart', '''
import 'exports_html.dart';
''');
- _computeResult(source, IS_CLIENT);
+ computeResult(source, IS_CLIENT);
expect(task, new isInstanceOf<BuildSourceClosuresTask>());
expect(outputs[IS_CLIENT], isTrue);
}
@@ -1269,7 +1269,7 @@ import 'exports_html.dart';
library lib_a;
import 'dart:html';
''');
- _computeResult(sourceA, IS_CLIENT);
+ computeResult(sourceA, IS_CLIENT);
expect(task, new isInstanceOf<BuildSourceClosuresTask>());
expect(outputs[IS_CLIENT], isTrue);
}
@@ -1283,7 +1283,7 @@ import 'b.dart';
library lib_b;
import 'dart:html';
''');
- _computeResult(sourceA, IS_CLIENT);
+ computeResult(sourceA, IS_CLIENT);
expect(task, new isInstanceOf<BuildSourceClosuresTask>());
expect(outputs[IS_CLIENT], isTrue);
}
@@ -1292,7 +1292,7 @@ import 'dart:html';
@reflectiveTest
class BuildTypeProviderTaskTest extends _AbstractDartTaskTest {
test_perform() {
- _computeResult(AnalysisContextTarget.request, TYPE_PROVIDER);
+ computeResult(AnalysisContextTarget.request, TYPE_PROVIDER);
expect(task, new isInstanceOf<BuildTypeProviderTask>());
// validate
TypeProvider typeProvider = outputs[TYPE_PROVIDER];
@@ -1325,7 +1325,7 @@ class D { const D(value); }
// First compute the resolved unit for the source.
LibrarySpecificUnit librarySpecificUnit =
new LibrarySpecificUnit(source, source);
- _computeResult(librarySpecificUnit, RESOLVED_UNIT1);
+ computeResult(librarySpecificUnit, RESOLVED_UNIT1);
CompilationUnit unit = outputs[RESOLVED_UNIT1];
// Find the elements for x and D's constructor, and the annotation on C.
List<PropertyAccessorElement> accessors = unit.element.accessors;
@@ -1338,7 +1338,7 @@ class D { const D(value); }
// Now compute the dependencies for the annotation, and check that it is
// the set [x, constructorForD].
// TODO(paulberry): test librarySource != source
- _computeResult(new ConstantEvaluationTarget_Annotation(
+ computeResult(new ConstantEvaluationTarget_Annotation(
context, source, source, annotation), CONSTANT_DEPENDENCIES);
expect(
outputs[CONSTANT_DEPENDENCIES].toSet(), [x, constructorForD].toSet());
@@ -1352,7 +1352,7 @@ const x = 1;
// First compute the resolved unit for the source.
LibrarySpecificUnit librarySpecificUnit =
new LibrarySpecificUnit(source, source);
- _computeResult(librarySpecificUnit, RESOLVED_UNIT1);
+ computeResult(librarySpecificUnit, RESOLVED_UNIT1);
CompilationUnit unit = outputs[RESOLVED_UNIT1];
// Find the element for x and the annotation on C.
List<PropertyAccessorElement> accessors = unit.element.accessors;
@@ -1361,7 +1361,7 @@ const x = 1;
Annotation annotation = findClassAnnotation(unit, 'C');
// Now compute the dependencies for the annotation, and check that it is
// the list [x].
- _computeResult(new ConstantEvaluationTarget_Annotation(
+ computeResult(new ConstantEvaluationTarget_Annotation(
context, source, source, annotation), CONSTANT_DEPENDENCIES);
expect(outputs[CONSTANT_DEPENDENCIES], [x]);
}
@@ -1373,7 +1373,7 @@ enum E {A, B, C}
// First compute the resolved unit for the source.
LibrarySpecificUnit librarySpecificUnit =
new LibrarySpecificUnit(source, source);
- _computeResult(librarySpecificUnit, RESOLVED_UNIT2);
+ computeResult(librarySpecificUnit, RESOLVED_UNIT2);
CompilationUnit unit = outputs[RESOLVED_UNIT2];
// Find the element for 'A'
EnumDeclaration enumDeclaration = unit.declarations[0];
@@ -1381,7 +1381,7 @@ enum E {A, B, C}
FieldElement constantElement = constantDeclaration.element;
// Now compute the dependencies for the constant and check that there are
// none.
- _computeResult(constantElement, CONSTANT_DEPENDENCIES);
+ computeResult(constantElement, CONSTANT_DEPENDENCIES);
expect(outputs[CONSTANT_DEPENDENCIES], isEmpty);
}
@@ -1393,7 +1393,7 @@ const y = 1;
// First compute the resolved unit for the source.
LibrarySpecificUnit librarySpecificUnit =
new LibrarySpecificUnit(source, source);
- _computeResult(librarySpecificUnit, RESOLVED_UNIT1);
+ computeResult(librarySpecificUnit, RESOLVED_UNIT1);
CompilationUnit unit = outputs[RESOLVED_UNIT1];
// Find the elements for the constants x and y.
List<PropertyAccessorElement> accessors = unit.element.accessors;
@@ -1402,7 +1402,7 @@ const y = 1;
Element y = accessors.firstWhere((PropertyAccessorElement accessor) =>
accessor.isGetter && accessor.name == 'y').variable;
// Now compute the dependencies for x, and check that it is the list [y].
- _computeResult(x, CONSTANT_DEPENDENCIES);
+ computeResult(x, CONSTANT_DEPENDENCIES);
expect(outputs[CONSTANT_DEPENDENCIES], [y]);
}
}
@@ -1418,7 +1418,7 @@ class ComputeConstantValueTaskTest extends _AbstractDartTaskTest {
ConstantEvaluationTarget_Annotation target =
new ConstantEvaluationTarget_Annotation(
context, source, source, annotation);
- _computeResult(target, CONSTANT_VALUE);
+ computeResult(target, CONSTANT_VALUE);
expect(outputs[CONSTANT_VALUE], same(target));
EvaluationResultImpl evaluationResult =
(annotation.elementAnnotation as ElementAnnotationImpl).evaluationResult;
@@ -1588,7 +1588,7 @@ const x = 1;
// Find the element for the given constant.
PropertyInducingElement variableElement = _findVariable(unit, variableName);
// Now compute the value of the constant.
- _computeResult(variableElement, CONSTANT_VALUE);
+ computeResult(variableElement, CONSTANT_VALUE);
expect(outputs[CONSTANT_VALUE], same(variableElement));
EvaluationResultImpl evaluationResult =
(variableElement as TopLevelVariableElementImpl).evaluationResult;
@@ -1613,7 +1613,7 @@ const x = 1;
CompilationUnit _resolveSource(Source source) {
LibrarySpecificUnit librarySpecificUnit =
new LibrarySpecificUnit(source, source);
- _computeResult(librarySpecificUnit, RESOLVED_UNIT1);
+ computeResult(librarySpecificUnit, RESOLVED_UNIT1);
CompilationUnit unit = outputs[RESOLVED_UNIT1];
return unit;
}
@@ -1660,8 +1660,8 @@ class ContainingLibrariesTaskTest extends _AbstractDartTaskTest {
test_perform_definingCompilationUnit() {
AnalysisTarget library = newSource('/test.dart', 'library test;');
- _computeResult(library, INCLUDED_PARTS);
- _computeResult(library, CONTAINING_LIBRARIES);
+ computeResult(library, INCLUDED_PARTS);
+ computeResult(library, CONTAINING_LIBRARIES);
expect(task, new isInstanceOf<ContainingLibrariesTask>());
expect(outputs, hasLength(1));
List<Source> containingLibraries = outputs[CONTAINING_LIBRARIES];
@@ -1674,10 +1674,10 @@ class ContainingLibrariesTaskTest extends _AbstractDartTaskTest {
AnalysisTarget library2 =
newSource('/lib2.dart', 'library test; part "part.dart";');
AnalysisTarget part = newSource('/part.dart', 'part of test;');
- _computeResult(library1, INCLUDED_PARTS);
- _computeResult(library2, INCLUDED_PARTS);
- _computeResult(part, SOURCE_KIND);
- _computeResult(part, CONTAINING_LIBRARIES);
+ computeResult(library1, INCLUDED_PARTS);
+ computeResult(library2, INCLUDED_PARTS);
+ computeResult(part, SOURCE_KIND);
+ computeResult(part, CONTAINING_LIBRARIES);
expect(task, new isInstanceOf<ContainingLibrariesTask>());
expect(outputs, hasLength(1));
List<Source> containingLibraries = outputs[CONTAINING_LIBRARIES];
@@ -1688,9 +1688,9 @@ class ContainingLibrariesTaskTest extends _AbstractDartTaskTest {
AnalysisTarget library =
newSource('/lib.dart', 'library test; part "part.dart";');
AnalysisTarget part = newSource('/part.dart', 'part of test;');
- _computeResult(library, INCLUDED_PARTS);
- _computeResult(part, SOURCE_KIND);
- _computeResult(part, CONTAINING_LIBRARIES);
+ computeResult(library, INCLUDED_PARTS);
+ computeResult(part, SOURCE_KIND);
+ computeResult(part, CONTAINING_LIBRARIES);
expect(task, new isInstanceOf<ContainingLibrariesTask>());
expect(outputs, hasLength(1));
List<Source> containingLibraries = outputs[CONTAINING_LIBRARIES];
@@ -1739,8 +1739,8 @@ class DartErrorsTaskTest extends _AbstractDartTaskTest {
test_perform_definingCompilationUnit() {
AnalysisTarget library =
newSource('/test.dart', 'library test; import "dart:math";');
- _computeResult(library, INCLUDED_PARTS);
- _computeResult(library, DART_ERRORS);
+ computeResult(library, INCLUDED_PARTS);
+ computeResult(library, DART_ERRORS);
expect(task, new isInstanceOf<DartErrorsTask>());
expect(outputs, hasLength(1));
List<AnalysisError> errors = outputs[DART_ERRORS];
@@ -1752,9 +1752,9 @@ class DartErrorsTaskTest extends _AbstractDartTaskTest {
'/lib.dart', 'library test; import "dart:math"; part "part.dart";');
AnalysisTarget part =
newSource('/part.dart', 'part of test; class A extends A {}');
- _computeResult(library, INCLUDED_PARTS);
- _computeResult(library, DART_ERRORS);
- _computeResult(part, DART_ERRORS);
+ computeResult(library, INCLUDED_PARTS);
+ computeResult(library, DART_ERRORS);
+ computeResult(part, DART_ERRORS);
expect(task, new isInstanceOf<DartErrorsTask>());
expect(outputs, hasLength(1));
List<AnalysisError> errors = outputs[DART_ERRORS];
@@ -1778,7 +1778,7 @@ f() {}
const x = const C();
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, RESOLVED_UNIT);
+ computeResult(target, RESOLVED_UNIT);
expect(task, new isInstanceOf<EvaluateUnitConstantsTask>());
CompilationUnit unit = outputs[RESOLVED_UNIT];
CompilationUnitElement unitElement = unit.element;
@@ -1818,7 +1818,7 @@ main() {
void _computeUsedElements(Source source) {
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, USED_IMPORTED_ELEMENTS);
+ computeResult(target, USED_IMPORTED_ELEMENTS);
expect(task, new isInstanceOf<GatherUsedImportedElementsTask>());
usedElements = outputs[USED_IMPORTED_ELEMENTS];
usedElementNames = usedElements.elements.map((e) => e.name).toSet();
@@ -1862,7 +1862,7 @@ main(A a, p) {
void _computeUsedElements(Source source) {
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, USED_LOCAL_ELEMENTS);
+ computeResult(target, USED_LOCAL_ELEMENTS);
expect(task, new isInstanceOf<GatherUsedLocalElementsTask>());
usedElements = outputs[USED_LOCAL_ELEMENTS];
usedElementNames = usedElements.elements.map((e) => e.name).toSet();
@@ -1877,7 +1877,7 @@ int main() {
}
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, HINTS);
+ computeResult(target, HINTS);
expect(task, new isInstanceOf<GenerateHintsTask>());
// validate
_fillErrorListener(HINTS);
@@ -1893,7 +1893,7 @@ main(p) {
}
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, HINTS);
+ computeResult(target, HINTS);
expect(task, new isInstanceOf<GenerateHintsTask>());
// validate
_fillErrorListener(HINTS);
@@ -1909,7 +1909,7 @@ main() {
}
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, HINTS);
+ computeResult(target, HINTS);
expect(task, new isInstanceOf<GenerateHintsTask>());
// validate
_fillErrorListener(HINTS);
@@ -1924,7 +1924,7 @@ int main() {
}
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, HINTS);
+ computeResult(target, HINTS);
expect(task, new isInstanceOf<GenerateHintsTask>());
// validate
_fillErrorListener(HINTS);
@@ -1944,7 +1944,7 @@ main() {
}
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, HINTS);
+ computeResult(target, HINTS);
expect(task, new isInstanceOf<GenerateHintsTask>());
// validate
_fillErrorListener(HINTS);
@@ -1967,7 +1967,7 @@ main() {
new A();
}''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, HINTS);
+ computeResult(target, HINTS);
expect(task, new isInstanceOf<GenerateHintsTask>());
// validate
_fillErrorListener(HINTS);
@@ -1985,7 +1985,7 @@ main() {
new A();
}''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, HINTS);
+ computeResult(target, HINTS);
expect(task, new isInstanceOf<GenerateHintsTask>());
// validate
_fillErrorListener(HINTS);
@@ -2001,7 +2001,7 @@ class B {
}
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, HINTS);
+ computeResult(target, HINTS);
expect(task, new isInstanceOf<GenerateHintsTask>());
// validate
_fillErrorListener(HINTS);
@@ -2016,7 +2016,7 @@ main() {
}
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, HINTS);
+ computeResult(target, HINTS);
expect(task, new isInstanceOf<GenerateHintsTask>());
// validate
_fillErrorListener(HINTS);
@@ -2032,7 +2032,7 @@ main() {
}
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, HINTS);
+ computeResult(target, HINTS);
expect(task, new isInstanceOf<GenerateHintsTask>());
// validate
_fillErrorListener(HINTS);
@@ -2046,7 +2046,7 @@ main() {
}
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, HINTS);
+ computeResult(target, HINTS);
expect(task, new isInstanceOf<GenerateHintsTask>());
// validate
_fillErrorListener(HINTS);
@@ -2072,7 +2072,7 @@ f(A a) {
}
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, HINTS);
+ computeResult(target, HINTS);
expect(task, new isInstanceOf<GenerateHintsTask>());
// validate
_fillErrorListener(HINTS);
@@ -2098,7 +2098,7 @@ X v2;
part of lib;
X v3;
''');
- _computeResult(library, LIBRARY_ERRORS_READY);
+ computeResult(library, LIBRARY_ERRORS_READY);
expect(task, new isInstanceOf<LibraryErrorsReadyTask>());
expect(outputs, hasLength(1));
bool ready = outputs[LIBRARY_ERRORS_READY];
@@ -2155,7 +2155,7 @@ class LibraryUnitErrorsTaskTest extends _AbstractDartTaskTest {
test_perform_definingCompilationUnit() {
AnalysisTarget library =
newSource('/test.dart', 'library test; import "dart:math";');
- _computeResult(
+ computeResult(
new LibrarySpecificUnit(library, library), LIBRARY_UNIT_ERRORS);
expect(task, new isInstanceOf<LibraryUnitErrorsTask>());
expect(outputs, hasLength(1));
@@ -2167,7 +2167,7 @@ class LibraryUnitErrorsTaskTest extends _AbstractDartTaskTest {
AnalysisTarget library =
newSource('/lib.dart', 'library test; part "part.dart";');
AnalysisTarget part = newSource('/part.dart', 'part of test;');
- _computeResult(new LibrarySpecificUnit(library, part), LIBRARY_UNIT_ERRORS);
+ computeResult(new LibrarySpecificUnit(library, part), LIBRARY_UNIT_ERRORS);
expect(task, new isInstanceOf<LibraryUnitErrorsTask>());
expect(outputs, hasLength(1));
List<AnalysisError> errors = outputs[LIBRARY_UNIT_ERRORS];
@@ -2228,7 +2228,7 @@ class B {}''');
test_perform_computeSourceKind_noDirectives_hasContainingLibrary() {
// Parse "lib.dart" to let the context know that "test.dart" is included.
- _computeResult(newSource('/lib.dart', r'''
+ computeResult(newSource('/lib.dart', r'''
library lib;
part 'test.dart';
'''), PARSED_UNIT);
@@ -2309,7 +2309,7 @@ class B {}''');
void _performParseTask(String content) {
AnalysisTarget target = newSource('/test.dart', content);
- _computeResult(target, PARSED_UNIT);
+ computeResult(target, PARSED_UNIT);
expect(task, new isInstanceOf<ParseDartTask>());
}
@@ -2334,7 +2334,7 @@ class B extends A {}
part of my_lib;
class C extends A {}
''');
- _computeResult(sourceLib, LIBRARY_ELEMENT5);
+ computeResult(sourceLib, LIBRARY_ELEMENT5);
expect(task, new isInstanceOf<ResolveLibraryTypeNamesTask>());
// validate
LibraryElement library = outputs[LIBRARY_ELEMENT5];
@@ -2368,7 +2368,7 @@ class B2 extends C {}
library c;
class C {}
''');
- _computeResult(sourceA, LIBRARY_ELEMENT5);
+ computeResult(sourceA, LIBRARY_ELEMENT5);
expect(task, new isInstanceOf<ResolveLibraryTypeNamesTask>());
// validate
LibraryElement library = outputs[LIBRARY_ELEMENT5];
@@ -2401,7 +2401,7 @@ main(A a) {
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
// prepare unit and "a.m()" invocation
- _computeResult(target, RESOLVED_UNIT6);
+ computeResult(target, RESOLVED_UNIT6);
CompilationUnit unit = outputs[RESOLVED_UNIT6];
// walk the AST
FunctionDeclaration function = unit.declarations[1];
@@ -2423,7 +2423,7 @@ main(A a) {
}
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, RESOLVED_UNIT6);
+ computeResult(target, RESOLVED_UNIT6);
expect(task, new isInstanceOf<ResolveUnitReferencesTask>());
// validate
_fillErrorListener(RESOLVE_REFERENCES_ERRORS);
@@ -2449,7 +2449,7 @@ main() {
new A<int>().m();
}
''');
- _computeResult(new LibrarySpecificUnit(sourceC, sourceC), RESOLVED_UNIT6);
+ computeResult(new LibrarySpecificUnit(sourceC, sourceC), RESOLVED_UNIT6);
expect(task, new isInstanceOf<ResolveUnitReferencesTask>());
// validate
CompilationUnit unit = outputs[RESOLVED_UNIT6];
@@ -2477,7 +2477,7 @@ class B extends A {}
int f(String p) => p.length;
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, RESOLVED_UNIT4);
+ computeResult(target, RESOLVED_UNIT4);
expect(task, new isInstanceOf<ResolveUnitTypeNamesTask>());
// validate
CompilationUnit unit = outputs[RESOLVED_UNIT4];
@@ -2502,7 +2502,7 @@ int f(String p) => p.length;
NoSuchClass f() => null;
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, RESOLVE_TYPE_NAMES_ERRORS);
+ computeResult(target, RESOLVE_TYPE_NAMES_ERRORS);
expect(task, new isInstanceOf<ResolveUnitTypeNamesTask>());
// validate
_fillErrorListener(RESOLVE_TYPE_NAMES_ERRORS);
@@ -2529,7 +2529,7 @@ main() {
}
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, RESOLVED_UNIT5);
+ computeResult(target, RESOLVED_UNIT5);
expect(task, new isInstanceOf<ResolveVariableReferencesTask>());
}
@@ -2549,7 +2549,7 @@ main() {
}
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, RESOLVED_UNIT5);
+ computeResult(target, RESOLVED_UNIT5);
expect(task, new isInstanceOf<ResolveVariableReferencesTask>());
// validate
CompilationUnit unit = outputs[RESOLVED_UNIT5];
@@ -2572,7 +2572,7 @@ main(p1, p2, p3, p4) {
}
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, RESOLVED_UNIT5);
+ computeResult(target, RESOLVED_UNIT5);
expect(task, new isInstanceOf<ResolveVariableReferencesTask>());
// validate
CompilationUnit unit = outputs[RESOLVED_UNIT5];
@@ -2634,7 +2634,7 @@ class ScanDartTaskTest extends _AbstractDartTaskTest {
void _performScanTask(String content) {
AnalysisTarget target = newSource('/test.dart', content);
- _computeResult(target, TOKEN_STREAM);
+ computeResult(target, TOKEN_STREAM);
expect(task, new isInstanceOf<ScanDartTask>());
}
}
@@ -2648,7 +2648,7 @@ main(int p) {
}
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, VERIFY_ERRORS);
+ computeResult(target, VERIFY_ERRORS);
expect(task, new isInstanceOf<VerifyUnitTask>());
// validate
_fillErrorListener(VERIFY_ERRORS);
@@ -2662,7 +2662,7 @@ main(int p) {
import 'no-such-file.dart';
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, VERIFY_ERRORS);
+ computeResult(target, VERIFY_ERRORS);
expect(task, new isInstanceOf<VerifyUnitTask>());
// validate
_fillErrorListener(VERIFY_ERRORS);
@@ -2679,7 +2679,7 @@ main() {
}
''');
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
- _computeResult(target, VERIFY_ERRORS);
+ computeResult(target, VERIFY_ERRORS);
expect(task, new isInstanceOf<VerifyUnitTask>());
// validate
_fillErrorListener(VERIFY_ERRORS);
@@ -2691,9 +2691,6 @@ main() {
class _AbstractDartTaskTest extends AbstractContextTest {
Source emptySource;
- AnalysisTask task;
- Map<ResultDescriptor<dynamic>, dynamic> oldOutputs;
- Map<ResultDescriptor<dynamic>, dynamic> outputs;
GatheringErrorListener errorListener = new GatheringErrorListener();
void assertIsInvalid(AnalysisTarget target, ResultDescriptor descriptor) {
@@ -2719,14 +2716,6 @@ class _AbstractDartTaskTest extends AbstractContextTest {
emptySource = newSource('/test.dart');
}
- void _computeResult(AnalysisTarget target, ResultDescriptor result) {
- oldOutputs = outputs;
- task = analysisDriver.computeResult(target, result);
- expect(task, isNotNull);
- expect(task.caughtException, isNull);
- outputs = task.outputs;
- }
-
/**
* Fill [errorListener] with [result] errors in the current [task].
*/

Powered by Google App Engine
This is Rietveld 408576698