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])); |
} |
} |