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

Unified Diff: pkg/analyzer_plugin/test/utilities/subscriptions/subscription_manager_test.dart

Issue 2861373005: Improve default support provided for plugins (Closed)
Patch Set: Created 3 years, 7 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/analyzer_plugin/test/utilities/subscriptions/subscription_manager_test.dart
diff --git a/pkg/analyzer_plugin/test/utilities/subscriptions/subscription_manager_test.dart b/pkg/analyzer_plugin/test/utilities/subscriptions/subscription_manager_test.dart
index 1487eb2d74a251d0ae76396ccfba93803030fba7..4bf79ff8283d036a1fee04db8cde11fd4dc4dfd3 100644
--- a/pkg/analyzer_plugin/test/utilities/subscriptions/subscription_manager_test.dart
+++ b/pkg/analyzer_plugin/test/utilities/subscriptions/subscription_manager_test.dart
@@ -20,19 +20,51 @@ class SubscriptionManagerTest {
}
test_setSubscriptions() {
- manager.setSubscriptions({
- AnalysisService.HIGHLIGHTS: [
- '/project/lib/foo.dart',
- '/project/lib/bar.dart'
- ],
- AnalysisService.NAVIGATION: ['/project/lib/foo.dart']
+ String fooPath = '/project/lib/foo.dart';
+ String barPath = '/project/lib/bar.dart';
+ String bazPath = '/project/lib/baz.dart';
+ //
+ // Set the initial set of subscriptions.
+ //
+ Map<String, List<AnalysisService>> newSubscriptions =
+ manager.setSubscriptions({
+ AnalysisService.HIGHLIGHTS: [fooPath, barPath],
+ AnalysisService.NAVIGATION: [fooPath]
});
- expect(manager.servicesForFile('/project/lib/test.dart'), hasLength(0));
- expect(manager.servicesForFile('/project/lib/bar.dart'),
+
+ expect(
+ manager.servicesForFile(fooPath),
+ unorderedEquals(
+ [AnalysisService.HIGHLIGHTS, AnalysisService.NAVIGATION]));
+ expect(manager.servicesForFile(barPath),
unorderedEquals([AnalysisService.HIGHLIGHTS]));
+ expect(manager.servicesForFile(bazPath), hasLength(0));
+
expect(
- manager.servicesForFile('/project/lib/foo.dart'),
+ newSubscriptions[fooPath],
unorderedEquals(
[AnalysisService.HIGHLIGHTS, AnalysisService.NAVIGATION]));
+ expect(newSubscriptions[barPath],
+ unorderedEquals([AnalysisService.HIGHLIGHTS]));
+ //
+ // Update the subscriptions.
+ //
+ newSubscriptions = manager.setSubscriptions({
+ AnalysisService.HIGHLIGHTS: [bazPath, barPath],
+ AnalysisService.NAVIGATION: [barPath]
+ });
+
+ expect(manager.servicesForFile(fooPath), hasLength(0));
+ expect(
+ manager.servicesForFile(barPath),
+ unorderedEquals(
+ [AnalysisService.HIGHLIGHTS, AnalysisService.NAVIGATION]));
+ expect(manager.servicesForFile(bazPath),
+ unorderedEquals([AnalysisService.HIGHLIGHTS]));
+
+ expect(newSubscriptions[barPath],
+ unorderedEquals([AnalysisService.NAVIGATION]));
+ expect(newSubscriptions[bazPath],
+ unorderedEquals([AnalysisService.HIGHLIGHTS]));
}
}

Powered by Google App Engine
This is Rietveld 408576698