OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import 'package:analyzer_plugin/protocol/generated_protocol.dart'; |
| 6 import 'package:analyzer_plugin/utilities/subscription_manager.dart'; |
| 7 import 'package:test/test.dart'; |
| 8 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 9 |
| 10 void main() { |
| 11 defineReflectiveTests(SubscriptionManagerTest); |
| 12 } |
| 13 |
| 14 @reflectiveTest |
| 15 class SubscriptionManagerTest { |
| 16 SubscriptionManager manager = new SubscriptionManager(); |
| 17 |
| 18 test_servicesForFile() { |
| 19 expect(manager.servicesForFile('/project/lib/test.dart'), hasLength(0)); |
| 20 } |
| 21 |
| 22 test_setSubscriptions() { |
| 23 manager.setSubscriptions({ |
| 24 AnalysisService.HIGHLIGHTS: [ |
| 25 '/project/lib/foo.dart', |
| 26 '/project/lib/bar.dart' |
| 27 ], |
| 28 AnalysisService.NAVIGATION: ['/project/lib/foo.dart'] |
| 29 }); |
| 30 expect(manager.servicesForFile('/project/lib/test.dart'), hasLength(0)); |
| 31 expect(manager.servicesForFile('/project/lib/bar.dart'), |
| 32 unorderedEquals([AnalysisService.HIGHLIGHTS])); |
| 33 expect( |
| 34 manager.servicesForFile('/project/lib/foo.dart'), |
| 35 unorderedEquals( |
| 36 [AnalysisService.HIGHLIGHTS, AnalysisService.NAVIGATION])); |
| 37 } |
| 38 } |
OLD | NEW |