| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library test.integration.analysis.navigation; | 5 library test.integration.analysis.navigation; |
| 6 | 6 |
| 7 import '../../reflective_tests.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 | 9 |
| 10 import '../../reflective_tests.dart'; |
| 10 import '../integration_tests.dart'; | 11 import '../integration_tests.dart'; |
| 11 | 12 |
| 12 @ReflectiveTestCase() | 13 @ReflectiveTestCase() |
| 13 class AnalysisNavigationTest extends AbstractAnalysisServerIntegrationTest { | 14 class AnalysisNavigationTest extends AbstractAnalysisServerIntegrationTest { |
| 14 test_navigation() { | 15 test_navigation() { |
| 15 String pathname1 = sourcePath('test1.dart'); | 16 String pathname1 = sourcePath('test1.dart'); |
| 16 String text1 = | 17 String text1 = |
| 17 r''' | 18 r''' |
| 18 library foo; | 19 library foo; |
| 19 | 20 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 44 } | 45 } |
| 45 '''; | 46 '''; |
| 46 writeFile(pathname1, text1); | 47 writeFile(pathname1, text1); |
| 47 String pathname2 = sourcePath('test2.dart'); | 48 String pathname2 = sourcePath('test2.dart'); |
| 48 String text2 = | 49 String text2 = |
| 49 r''' | 50 r''' |
| 50 part of foo; | 51 part of foo; |
| 51 '''; | 52 '''; |
| 52 writeFile(pathname2, text2); | 53 writeFile(pathname2, text2); |
| 53 standardAnalysisSetup(); | 54 standardAnalysisSetup(); |
| 54 sendAnalysisSetSubscriptions({'NAVIGATION': [pathname1]}); | 55 sendAnalysisSetSubscriptions({AnalysisService.NAVIGATION: [pathname1]}); |
| 55 List regions; | 56 List regions; |
| 56 onAnalysisNavigation.listen((params) { | 57 onAnalysisNavigation.listen((params) { |
| 57 expect(params['file'], equals(pathname1)); | 58 expect(params['file'], equals(pathname1)); |
| 58 regions = params['regions']; | 59 regions = params['regions']; |
| 59 }); | 60 }); |
| 60 return analysisFinished.then((_) { | 61 return analysisFinished.then((_) { |
| 61 // There should be a single error, due to the fact that 'dart:async' is | 62 // There should be a single error, due to the fact that 'dart:async' is |
| 62 // not used. | 63 // not used. |
| 63 expect(currentAnalysisErrors[pathname1], hasLength(1)); | 64 expect(currentAnalysisErrors[pathname1], hasLength(1)); |
| 64 expect(currentAnalysisErrors[pathname2], isEmpty); | 65 expect(currentAnalysisErrors[pathname2], isEmpty); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 checkLocal('field = 1', 'field;', 'SETTER'); | 103 checkLocal('field = 1', 'field;', 'SETTER'); |
| 103 checkLocal('topLevelVariable;', 'topLevelVariable;', 'TOP_LEVEL_VARIABLE')
; | 104 checkLocal('topLevelVariable;', 'topLevelVariable;', 'TOP_LEVEL_VARIABLE')
; |
| 104 checkLocal('TypeParameter field;', 'TypeParameter>', 'TYPE_PARAMETER'); | 105 checkLocal('TypeParameter field;', 'TypeParameter>', 'TYPE_PARAMETER'); |
| 105 }); | 106 }); |
| 106 } | 107 } |
| 107 } | 108 } |
| 108 | 109 |
| 109 main() { | 110 main() { |
| 110 runReflectiveTests(AnalysisNavigationTest); | 111 runReflectiveTests(AnalysisNavigationTest); |
| 111 } | 112 } |
| OLD | NEW |