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

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

Issue 1012993004: Task: Build Export Source Closure. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | no next file » | 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 54948078480eb769cb2834656baf265ea4eb6cd3..001816966d038ecc24540a20d527172a0d6ad2dd 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -36,6 +36,7 @@ main() {
runReflectiveTests(BuildCompilationUnitElementTaskTest);
runReflectiveTests(BuildDirectiveElementsTaskTest);
runReflectiveTests(BuildEnumMemberElementsTaskTest);
+ runReflectiveTests(BuildExportSourceClosureTaskTest);
runReflectiveTests(BuildLibraryElementTaskTest);
runReflectiveTests(BuildPublicNamespaceTaskTest);
runReflectiveTests(BuildTypeProviderTaskTest);
@@ -437,6 +438,48 @@ enum MyEnum {
}
@reflectiveTest
+class BuildExportSourceClosureTaskTest extends _AbstractDartTaskTest {
+ test_perform() {
+ Source sourceA = _newSource('/a.dart', '''
+library lib_a;
+export 'b.dart';
+''');
+ Source sourceB = _newSource('/b.dart', '''
+library lib_b;
+export 'b.dart';
+''');
+ Source sourceC = _newSource('/c.dart', '''
+library lib_c;
+export 'a.dart';
+''');
+ Source sourceD = _newSource('/d.dart', '''
+library lib_d;
+''');
+ // a.dart
+ {
+ _computeResult(sourceA, EXPORT_SOURCE_CLOSURE);
+ expect(task, new isInstanceOf<BuildExportSourceClosureTask>());
+ List<Source> closure = outputs[EXPORT_SOURCE_CLOSURE];
+ expect(closure, unorderedEquals([sourceA, sourceB]));
+ }
+ // c.dart
+ {
+ _computeResult(sourceC, EXPORT_SOURCE_CLOSURE);
+ expect(task, new isInstanceOf<BuildExportSourceClosureTask>());
+ List<Source> closure = outputs[EXPORT_SOURCE_CLOSURE];
+ expect(closure, unorderedEquals([sourceA, sourceB, sourceC]));
+ }
+ // d.dart
+ {
+ _computeResult(sourceD, EXPORT_SOURCE_CLOSURE);
+ expect(task, new isInstanceOf<BuildExportSourceClosureTask>());
+ List<Source> closure = outputs[EXPORT_SOURCE_CLOSURE];
+ expect(closure, unorderedEquals([sourceD]));
+ }
+ }
+}
+
+@reflectiveTest
class BuildLibraryElementTaskTest extends _AbstractDartTaskTest {
Source librarySource;
CompilationUnit libraryUnit;
@@ -930,6 +973,7 @@ class _AbstractDartTaskTest extends EngineTestCase {
taskManager.addTaskDescriptor(BuildLibraryElementTask.DESCRIPTOR);
taskManager.addTaskDescriptor(BuildPublicNamespaceTask.DESCRIPTOR);
taskManager.addTaskDescriptor(BuildDirectiveElementsTask.DESCRIPTOR);
+ taskManager.addTaskDescriptor(BuildExportSourceClosureTask.DESCRIPTOR);
taskManager.addTaskDescriptor(BuildTypeProviderTask.DESCRIPTOR);
taskManager.addTaskDescriptor(BuildEnumMemberElementsTask.DESCRIPTOR);
// prepare AnalysisDriver
@@ -986,6 +1030,14 @@ class _MockContext extends TypedMock implements ExtendedAnalysisContext {
TimestampedData<String> getContents(Source source) => source.contents;
+ @override
+ Namespace getPublicNamespace(LibraryElement library) {
+ // TODO(scheglov) Should be be replaced with an explicit input?
Brian Wilkerson 2015/03/17 13:52:49 "be be" --> "be"
+ // TODO(scheglov) Based on... LibraryElement's closure?
+ var cacheEntry = getCacheEntry(library.source);
+ return cacheEntry.getValue(PUBLIC_NAMESPACE);
+ }
+
noSuchMethod(Invocation invocation) {
print('noSuchMethod: ${invocation.memberName}');
return super.noSuchMethod(invocation);
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698