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

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

Issue 1486663003: Ensure that a complete library element has constants evaluated (issue 24890) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated after breaking changes Created 5 years 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
« no previous file with comments | « pkg/analyzer/test/src/context/context_test.dart ('k') | pkg/analyzer/tool/task_dependency_graph/tasks.dot » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 09d71ad387d48fdf969dc604b61406c933c60729..669b909258a07fc0a3e9022e043b2931a842ee40 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -62,6 +62,7 @@ main() {
runReflectiveTests(PropagateVariableTypesInUnitTaskTest);
runReflectiveTests(PropagateVariableTypeTaskTest);
runReflectiveTests(ResolveInstanceFieldsInUnitTaskTest);
+ runReflectiveTests(ResolveLibraryTaskTest);
runReflectiveTests(ResolveLibraryTypeNamesTaskTest);
runReflectiveTests(ResolveUnitTaskTest);
runReflectiveTests(ResolveUnitTypeNamesTaskTest);
@@ -124,6 +125,7 @@ isInstanceOf isPropagateVariableTypesInUnitTask =
new isInstanceOf<PropagateVariableTypesInUnitTask>();
isInstanceOf isPropagateVariableTypeTask =
new isInstanceOf<PropagateVariableTypeTask>();
+isInstanceOf isResolveLibraryTask = new isInstanceOf<ResolveLibraryTask>();
isInstanceOf isResolveLibraryTypeNamesTask =
new isInstanceOf<ResolveLibraryTypeNamesTask>();
isInstanceOf isResolveUnitTask = new isInstanceOf<ResolveUnitTask>();
@@ -3542,6 +3544,32 @@ class ResolveInstanceFieldsInUnitTaskTest extends _AbstractDartTaskTest {
}
@reflectiveTest
+class ResolveLibraryTaskTest extends _AbstractDartTaskTest {
+ test_perform() {
+ Source sourceLib = newSource(
+ '/my_lib.dart',
+ '''
+library my_lib;
+const a = new A();
+class A {
+ const A();
+}
+@a
+class C {}
+''');
+ computeResult(sourceLib, LIBRARY_ELEMENT, matcher: isResolveLibraryTask);
+ // validate
+ LibraryElement library = outputs[LIBRARY_ELEMENT];
+ ClassElement classC = library.getType('C');
+ List<ElementAnnotation> metadata = classC.metadata;
+ expect(metadata, hasLength(1));
+ ElementAnnotation annotation = metadata[0];
+ expect(annotation, isNotNull);
+ expect((annotation as ElementAnnotationImpl).evaluationResult, isNotNull);
+ }
+}
+
+@reflectiveTest
class ResolveLibraryTypeNamesTaskTest extends _AbstractDartTaskTest {
test_perform() {
Source sourceLib = newSource(
« no previous file with comments | « pkg/analyzer/test/src/context/context_test.dart ('k') | pkg/analyzer/tool/task_dependency_graph/tasks.dot » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698