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

Unified Diff: pkg/analysis_server/test/domain_analysis_test.dart

Issue 337383005: PackageMapUriResolver for Dart server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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/analysis_server/test/domain_analysis_test.dart
diff --git a/pkg/analysis_server/test/domain_analysis_test.dart b/pkg/analysis_server/test/domain_analysis_test.dart
index db5730a7a8df86efb9222f399b5bc39851dfb856..918b5d470baca4b14edfd1a69a3eec9807183d36 100644
--- a/pkg/analysis_server/test/domain_analysis_test.dart
+++ b/pkg/analysis_server/test/domain_analysis_test.dart
@@ -15,11 +15,15 @@ import 'package:analysis_server/src/resource.dart';
import 'package:unittest/unittest.dart';
import 'mocks.dart';
+import 'analysis_abstract.dart';
+import 'reflective_tests.dart';
main() {
groupSep = ' | ';
+ runReflectiveTests(AnalysisDomainTest);
+
MockServerChannel serverChannel;
AnalysisServer server;
AnalysisDomainHandler handler;
@@ -1666,3 +1670,39 @@ void test_setSubscriptions() {
});
});
}
+
+
+@ReflectiveTestCase()
+class AnalysisDomainTest extends AbstractAnalysisTest {
+ Map<String, List<AnalysisError>> filesErrors = {};
+
+ void processNotification(Notification notification) {
+ if (notification.event == ANALYSIS_ERRORS) {
+ String file = notification.getParameter(FILE);
+ List<Map<String, Object>> errorMaps = notification.getParameter(ERRORS);
+ filesErrors[file] = errorMaps.map(jsonToAnalysisError).toList();
+ }
+ }
+
+ test_setRoots_packages() {
+ // prepare project with 'packages' folder
+ String pkgFile = '/project/packages/pkgA/libA.dart';
+ resourceProvider.newFile(pkgFile, '''
+library lib_a;
+class A {}
+''');
+ addTestFile('''
+import 'package:pkgA/libA.dart';
+main(A a) {
+}
+''');
+ // create project and wait for analysis
+ createProject();
+ return waitForTasksFinished().then((_) {
+ // if 'package:pkgA/libA.dart' was resolved, then there are no errors
+ expect(filesErrors[testFile], isEmpty);
+ // packages file also was resolved
+ expect(filesErrors[pkgFile], isEmpty);
+ });
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698