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_server; | 5 library test.analysis_server; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
10 import 'package:analysis_server/src/constants.dart'; | 10 import 'package:analysis_server/src/constants.dart'; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 server.folderMap[dir2] = context2; | 236 server.folderMap[dir2] = context2; |
237 | 237 |
238 ContextSourcePair pair = server.getContextSourcePair(filePath); | 238 ContextSourcePair pair = server.getContextSourcePair(filePath); |
239 Source source = pair.source; | 239 Source source = pair.source; |
240 expect(pair.context, same(context2)); | 240 expect(pair.context, same(context2)); |
241 expect(source, isNotNull); | 241 expect(source, isNotNull); |
242 expect(source.uri.scheme, 'file'); | 242 expect(source.uri.scheme, 'file'); |
243 expect(source.fullName, filePath); | 243 expect(source.fullName, filePath); |
244 } | 244 } |
245 | 245 |
| 246 test_getContextSourcePair_nonFile() { |
| 247 String dirPath = '/dir'; |
| 248 Folder dir = resourceProvider.newFolder(dirPath); |
| 249 |
| 250 AnalysisContext context = AnalysisEngine.instance.createAnalysisContext(); |
| 251 _configureSourceFactory(context); |
| 252 server.folderMap[dir] = context; |
| 253 |
| 254 ContextSourcePair pair = server.getContextSourcePair(dirPath); |
| 255 expect(pair, isNull); |
| 256 } |
| 257 |
246 test_getContextSourcePair_package_inRoot() { | 258 test_getContextSourcePair_package_inRoot() { |
247 String rootPath = '/my_package'; | 259 String rootPath = '/my_package'; |
248 String filePath = rootPath + '/lib/file.dart'; | 260 String filePath = rootPath + '/lib/file.dart'; |
249 Folder rootFolder = resourceProvider.newFolder(rootPath); | 261 Folder rootFolder = resourceProvider.newFolder(rootPath); |
250 resourceProvider.newFile(filePath, 'library lib;'); | 262 resourceProvider.newFile(filePath, 'library lib;'); |
251 | 263 |
252 packageMapProvider.packageMap = <String, List<Folder>>{ | 264 packageMapProvider.packageMap = <String, List<Folder>>{ |
253 'my_package': <Folder>[rootFolder] | 265 'my_package': <Folder>[rootFolder] |
254 }; | 266 }; |
255 | 267 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 _MockServerOperation(this.context); | 493 _MockServerOperation(this.context); |
482 | 494 |
483 @override | 495 @override |
484 ServerOperationPriority get priority => ServerOperationPriority.ANALYSIS; | 496 ServerOperationPriority get priority => ServerOperationPriority.ANALYSIS; |
485 | 497 |
486 @override | 498 @override |
487 void perform(AnalysisServer server) { | 499 void perform(AnalysisServer server) { |
488 isComplete = true; | 500 isComplete = true; |
489 } | 501 } |
490 } | 502 } |
OLD | NEW |