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

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

Issue 2667823003: Add top-level driver and abstract plugin superclass (Closed)
Patch Set: Created 3 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
Index: pkg/analyzer_plugin/test/utilities/subscription_manager_test.dart
diff --git a/pkg/analyzer_plugin/test/utilities/subscription_manager_test.dart b/pkg/analyzer_plugin/test/utilities/subscription_manager_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..826113bd94e240a31bba1d697d21f2560e8b21bd
--- /dev/null
+++ b/pkg/analyzer_plugin/test/utilities/subscription_manager_test.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2017, 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.
+
+import 'package:analyzer_plugin/protocol/generated_protocol.dart';
+import 'package:analyzer_plugin/utilities/subscription_manager.dart';
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+void main() {
+ defineReflectiveTests(SubscriptionManagerTest);
+}
+
+@reflectiveTest
+class SubscriptionManagerTest {
+ SubscriptionManager manager = new SubscriptionManager();
+
+ test_servicesForFile() {
+ expect(manager.servicesForFile('/project/lib/test.dart'), hasLength(0));
+ }
+
+ test_setSubscriptions() {
+ manager.setSubscriptions({
+ AnalysisService.HIGHLIGHTS: [
+ '/project/lib/foo.dart',
+ '/project/lib/bar.dart'
+ ],
+ AnalysisService.NAVIGATION: ['/project/lib/foo.dart']
+ });
+ expect(manager.servicesForFile('/project/lib/test.dart'), hasLength(0));
+ expect(manager.servicesForFile('/project/lib/bar.dart'),
+ unorderedEquals([AnalysisService.HIGHLIGHTS]));
+ expect(
+ manager.servicesForFile('/project/lib/foo.dart'),
+ unorderedEquals(
+ [AnalysisService.HIGHLIGHTS, AnalysisService.NAVIGATION]));
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698