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

Unified Diff: pkg/analysis_server/test/services/dependencies/library_dependencies_test.dart

Issue 868873002: Library dependency service tests. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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 | « no previous file | pkg/analysis_server/test/services/dependencies/test_all.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/dependencies/library_dependencies_test.dart
===================================================================
--- pkg/analysis_server/test/services/dependencies/library_dependencies_test.dart (revision 0)
+++ pkg/analysis_server/test/services/dependencies/library_dependencies_test.dart (revision 0)
@@ -0,0 +1,50 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library test.services.dependencies.library;
+
+import 'package:analysis_server/src/services/dependencies/library_dependencies.dart';
+import 'package:unittest/unittest.dart';
+
+import '../../abstract_context.dart';
+import '../../reflective_tests.dart';
+
+main() {
+ groupSep = ' | ';
+ runReflectiveTests(LibraryDependenciesTest);
+}
+
+
+@reflectiveTest
+class LibraryDependenciesTest extends AbstractContextTest {
+
+ test_Dependencies() {
+ addSource('/lib1.dart', '');
+ addSource('/lib2.dart', 'import "lib1.dart";');
+ addSource('/lib3.dart', 'import "lib2.dart";');
+ addSource('/lib4.dart', 'import "lib5.dart";');
scheglov 2015/01/22 22:26:45 I would add a cycle to test that we don't get into
pquitslund 2015/01/22 22:38:47 Good idea!
+ provider.newFile('/lib5.dart', 'import "lib6.dart";');
+ provider.newFile('/lib6.dart', '');
+
+ _performAnalysis();
+
+ var libs =
+ new LibraryDependencyCollector([context]).collectLibraryDependencies();
+
+ // Sources
+ expect(libs, contains('/lib1.dart'));
+ expect(libs, contains('/lib2.dart'));
+ expect(libs, contains('/lib3.dart'));
+ expect(libs, contains('/lib4.dart'));
+ // Non-source, referenced by source
+ expect(libs, contains('/lib5.dart'));
+ // Non-source, referenced by non-source
+ expect(libs, contains('/lib6.dart'));
+ }
+
+ void _performAnalysis() {
+ while (context.performAnalysisTask().hasMoreWork);
+ }
+}
+
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/dependencies/test_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698