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

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

Issue 1131953004: Create a task in the new task model to compute constant dependencies. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 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 =
« pkg/analyzer/lib/src/task/dart.dart ('K') | « pkg/analyzer/test/generated/all_the_rest_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698