| 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.analysis.get_navigation; | 5 library test.analysis.get_navigation; |
| 6 | 6 |
| 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 8 import 'package:analysis_server/src/domain_analysis.dart'; | 8 import 'package:analysis_server/src/domain_analysis.dart'; |
| 9 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
| 10 import 'package:test/test.dart'; | 10 import 'package:test/test.dart'; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 await _getNavigation(testFile, testCode.indexOf('test);'), 0); | 42 await _getNavigation(testFile, testCode.indexOf('test);'), 0); |
| 43 assertHasRegion('test);'); | 43 assertHasRegion('test);'); |
| 44 assertHasTarget('test = 0'); | 44 assertHasTarget('test = 0'); |
| 45 } | 45 } |
| 46 | 46 |
| 47 test_fileDoesNotExist() { | 47 test_fileDoesNotExist() { |
| 48 String file = '$projectPath/doesNotExist.dart'; | 48 String file = '$projectPath/doesNotExist.dart'; |
| 49 return _checkInvalid(file, -1, -1); | 49 return _checkInvalid(file, -1, -1); |
| 50 } | 50 } |
| 51 | 51 |
| 52 test_fileWithoutContext() { | |
| 53 String file = '/outside.dart'; | |
| 54 addFile( | |
| 55 file, | |
| 56 ''' | |
| 57 main() { | |
| 58 print(42); | |
| 59 } | |
| 60 '''); | |
| 61 return _checkInvalid(file, -1, -1); | |
| 62 } | |
| 63 | |
| 64 test_importDirective() async { | 52 test_importDirective() async { |
| 65 addTestFile(''' | 53 addTestFile(''' |
| 66 import 'dart:math'; | 54 import 'dart:math'; |
| 67 | 55 |
| 68 main() { | 56 main() { |
| 69 }'''); | 57 }'''); |
| 70 await waitForTasksFinished(); | 58 await waitForTasksFinished(); |
| 71 await _getNavigation(testFile, 0, 17); | 59 await _getNavigation(testFile, 0, 17); |
| 72 expect(regions, hasLength(1)); | 60 expect(regions, hasLength(1)); |
| 73 assertHasRegionString("'dart:math'"); | 61 assertHasRegionString("'dart:math'"); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 239 } |
| 252 | 240 |
| 253 @reflectiveTest | 241 @reflectiveTest |
| 254 class GetNavigationTest_Driver extends GetNavigationTest { | 242 class GetNavigationTest_Driver extends GetNavigationTest { |
| 255 @override | 243 @override |
| 256 void setUp() { | 244 void setUp() { |
| 257 enableNewAnalysisDriver = true; | 245 enableNewAnalysisDriver = true; |
| 258 generateSummaryFiles = true; | 246 generateSummaryFiles = true; |
| 259 super.setUp(); | 247 super.setUp(); |
| 260 } | 248 } |
| 249 |
| 250 test_fileOutsideOfRoot() async { |
| 251 testFile = '/outside.dart'; |
| 252 addTestFile(''' |
| 253 main() { |
| 254 var test = 0; |
| 255 print(test); |
| 261 } | 256 } |
| 257 '''); |
| 258 await _getNavigation(testFile, testCode.indexOf('test);'), 0); |
| 259 assertHasRegion('test);'); |
| 260 assertHasTarget('test = 0'); |
| 261 } |
| 262 } |
| OLD | NEW |