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

Unified Diff: test/dependency_graph_test.dart

Issue 1001563003: Fix in multi-package-resolver to support files that will be created later (graph (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
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 | « lib/src/testing.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/dependency_graph_test.dart
diff --git a/test/dependency_graph_test.dart b/test/dependency_graph_test.dart
index 18c19305da47f3eea0aa1ea4eacf073bd642ec04..f197543a949bba3044f184ea5983627ce98abaac 100644
--- a/test/dependency_graph_test.dart
+++ b/test/dependency_graph_test.dart
@@ -1128,6 +1128,72 @@ main() {
''');
});
});
+
+ group('represented non-existing files', () {
+ test('recognize locally change between existing and not-existing', () {
+ var n = nodeOf('/foo.dart');
+ expect(n.source, isNotNull);
+ expect(n.source.exists(), isFalse);
+ var source = testUriResolver.files[new Uri.file('/foo.dart')];
+ expect(n.source, source);
+ source.contents.data = "hi";
+ source.contents.modificationTime++;
+ expect(n.source.exists(), isTrue);
+ });
+
+ test('non-existing files are tracked in dependencies', () {
+ var node = nodeOf('/foo.dart');
+ node.source.contents.data = "import 'bar.dart';";
+ rebuild(node, graph, buildNoTransitiveChange);
+ expect(node.allDeps.contains(nodeOf('/bar.dart')), isTrue);
+
+ var source = nodeOf('/bar.dart').source;
+ source.contents.data = "hi";
+ source.contents.modificationTime++;
+ results = [];
+ rebuild(node, graph, buildWithTransitiveChange);
+ expect(results, ['bar.dart', 'foo.dart']);
+ });
+ });
+
+ group('null for non-existing files', () {
+ setUp(() {
+ testUriResolver =
+ new TestUriResolver(testFiles, representNonExistingFiles: false);
+ context = new TypeResolver.fromMock(mockSdkSources, options,
+ otherResolvers: [testUriResolver]).context;
+ graph = new SourceGraph(context, new LogReporter(), options);
+ });
+
+ test('recognize locally change between existing and not-existing', () {
+ var n = nodeOf('/foo.dart');
+ expect(n.source, isNull);
+ var source = new TestSource(new Uri.file('/foo.dart'), "hi");
+ testUriResolver.files[source.uri] = source;
+ expect(n.source, isNull);
+ n.update(graph);
+ expect(n.source, source);
+ expect(n.source.exists(), isTrue);
+ expect(n.needsRebuild, isTrue);
+ });
+
+ test('non-existing files are tracked in dependencies', () {
+ var s1 =
+ new TestSource(new Uri.file('/foo.dart'), "import 'bar.dart';");
+ testUriResolver.files[s1.uri] = s1;
+ var node = nodeOf('/foo.dart');
+ rebuild(node, graph, buildNoTransitiveChange);
+ expect(node.allDeps.length, 1);
+ expect(node.allDeps.contains(nodeOf('/bar.dart')), isTrue);
+ expect(nodeOf('/bar.dart').source, isNull);
+
+ var s2 = new TestSource(new Uri.file('/bar.dart'), "hi");
+ testUriResolver.files[s2.uri] = s2;
+ results = [];
+ rebuild(node, graph, buildWithTransitiveChange);
+ expect(results, ['bar.dart', 'foo.dart']);
+ });
+ });
});
}
« no previous file with comments | « lib/src/testing.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698