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 70e76f97260613aa096368c431a3716fc3d0beca..e62b3de0b0b02770dd0e0ce6a234cd4c42670f1c 100644 |
--- a/pkg/analyzer/test/src/task/dart_test.dart |
+++ b/pkg/analyzer/test/src/task/dart_test.dart |
@@ -33,6 +33,7 @@ main() { |
runReflectiveTests(BuildLibraryElementTaskTest); |
runReflectiveTests(BuildPublicNamespaceTaskTest); |
runReflectiveTests(BuildTypeProviderTaskTest); |
+ runReflectiveTests(ComputeConstantDependenciesTaskTest); |
runReflectiveTests(ContainingLibrariesTaskTest); |
runReflectiveTests(DartErrorsTaskTest); |
runReflectiveTests(GatherUsedImportedElementsTaskTest); |
@@ -1187,6 +1188,29 @@ class BuildTypeProviderTaskTest extends _AbstractDartTaskTest { |
} |
@reflectiveTest |
+class ComputeConstantDependenciesTaskTest extends _AbstractDartTaskTest { |
+ test_perform() { |
+ Source source = newSource('/test.dart', ''' |
+const x = y; |
+const y = 1; |
+'''); |
+ // First compute the library element for the source. |
+ _computeResult(source, LIBRARY_ELEMENT1); |
+ LibraryElement libraryElement = outputs[LIBRARY_ELEMENT1]; |
+ // Find the elements for the constant x and y. |
Brian Wilkerson
2015/05/07 22:46:59
"constant" --> "constants"
Paul Berry
2015/05/08 00:24:35
Done.
|
+ List<PropertyAccessorElement> accessors = |
+ libraryElement.definingCompilationUnit.accessors; |
+ Element x = accessors.firstWhere((PropertyAccessorElement accessor) => |
+ accessor.isGetter && accessor.name == 'x').variable; |
+ 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); |
+ expect(outputs[CONSTANT_DEPENDENCIES], [y]); |
+ } |
+} |
+ |
+@reflectiveTest |
class ContainingLibrariesTaskTest extends _AbstractDartTaskTest { |
test_buildInputs() { |
Map<String, TaskInput> inputs = |