| 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.packageRoot; | 5 library test.integration.analysis.packageRoot; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/protocol.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
| 8 import 'package:path/path.dart'; | 8 import 'package:path/path.dart'; |
| 9 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 9 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| 11 | 11 |
| 12 import '../../utils.dart'; |
| 12 import '../integration_tests.dart'; | 13 import '../integration_tests.dart'; |
| 13 | 14 |
| 14 main() { | 15 main() { |
| 16 initializeTestEnvironment(); |
| 15 defineReflectiveTests(Test); | 17 defineReflectiveTests(Test); |
| 16 } | 18 } |
| 17 | 19 |
| 18 @reflectiveTest | 20 @reflectiveTest |
| 19 class Test extends AbstractAnalysisServerIntegrationTest { | 21 class Test extends AbstractAnalysisServerIntegrationTest { |
| 20 test_package_root() { | 22 test_package_root() { |
| 21 String projPath = sourcePath('project'); | 23 String projPath = sourcePath('project'); |
| 22 String mainPath = join(projPath, 'main.dart'); | 24 String mainPath = join(projPath, 'main.dart'); |
| 23 String packagesPath = sourcePath('packages'); | 25 String packagesPath = sourcePath('packages'); |
| 24 String fooBarPath = join(packagesPath, 'foo', 'bar.dart'); | 26 String fooBarPath = join(packagesPath, 'foo', 'bar.dart'); |
| 25 String mainText = """ | 27 String mainText = """ |
| 26 library main; | 28 library main; |
| 27 | 29 |
| 28 import 'package:foo/bar.dart' | 30 import 'package:foo/bar.dart' |
| 29 | 31 |
| 30 main() { | 32 main() { |
| 31 f(); | 33 f(); |
| 32 } | 34 } |
| 33 """; | 35 """; |
| 34 String fooBarText = """ | 36 String fooBarText = """ |
| 35 library foo.bar; | 37 library foo.bar; |
| 36 | 38 |
| 37 f() {} | 39 f() {} |
| 38 """; | 40 """; |
| 39 writeFile(mainPath, mainText); | 41 writeFile(mainPath, mainText); |
| 40 String normalizedFooBarPath = writeFile(fooBarPath, fooBarText); | 42 String normalizedFooBarPath = writeFile(fooBarPath, fooBarText); |
| 41 sendServerSetSubscriptions([ServerService.STATUS]); | 43 sendServerSetSubscriptions([ServerService.STATUS]); |
| 42 sendAnalysisSetSubscriptions({AnalysisService.NAVIGATION: [mainPath]}); | 44 sendAnalysisSetSubscriptions({ |
| 45 AnalysisService.NAVIGATION: [mainPath] |
| 46 }); |
| 43 List<NavigationRegion> navigationRegions; | 47 List<NavigationRegion> navigationRegions; |
| 44 List<NavigationTarget> navigationTargets; | 48 List<NavigationTarget> navigationTargets; |
| 45 List<String> navigationTargetFiles; | 49 List<String> navigationTargetFiles; |
| 46 onAnalysisNavigation.listen((AnalysisNavigationParams params) { | 50 onAnalysisNavigation.listen((AnalysisNavigationParams params) { |
| 47 expect(params.file, equals(mainPath)); | 51 expect(params.file, equals(mainPath)); |
| 48 navigationRegions = params.regions; | 52 navigationRegions = params.regions; |
| 49 navigationTargets = params.targets; | 53 navigationTargets = params.targets; |
| 50 navigationTargetFiles = params.files; | 54 navigationTargetFiles = params.files; |
| 51 }); | 55 }); |
| 52 sendAnalysisSetAnalysisRoots([projPath], [], | 56 sendAnalysisSetAnalysisRoots([projPath], [], |
| (...skipping 13 matching lines...) Expand all Loading... |
| 66 navigationTargets[navigationTargetIndex]; | 70 navigationTargets[navigationTargetIndex]; |
| 67 String navigationFile = | 71 String navigationFile = |
| 68 navigationTargetFiles[navigationTarget.fileIndex]; | 72 navigationTargetFiles[navigationTarget.fileIndex]; |
| 69 expect(navigationFile, equals(normalizedFooBarPath)); | 73 expect(navigationFile, equals(normalizedFooBarPath)); |
| 70 } | 74 } |
| 71 } | 75 } |
| 72 expect(found, isTrue); | 76 expect(found, isTrue); |
| 73 }); | 77 }); |
| 74 } | 78 } |
| 75 } | 79 } |
| OLD | NEW |