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, isNotNull); |
| 256 expect(pair.context, isNull); |
| 257 expect(pair.source, isNull); |
| 258 } |
| 259 |
246 test_getContextSourcePair_package_inRoot() { | 260 test_getContextSourcePair_package_inRoot() { |
247 String rootPath = '/my_package'; | 261 String rootPath = '/my_package'; |
248 String filePath = rootPath + '/lib/file.dart'; | 262 String filePath = rootPath + '/lib/file.dart'; |
249 Folder rootFolder = resourceProvider.newFolder(rootPath); | 263 Folder rootFolder = resourceProvider.newFolder(rootPath); |
250 resourceProvider.newFile(filePath, 'library lib;'); | 264 resourceProvider.newFile(filePath, 'library lib;'); |
251 | 265 |
252 packageMapProvider.packageMap = <String, List<Folder>>{ | 266 packageMapProvider.packageMap = <String, List<Folder>>{ |
253 'my_package': <Folder>[rootFolder] | 267 'my_package': <Folder>[rootFolder] |
254 }; | 268 }; |
255 | 269 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 _MockServerOperation(this.context); | 495 _MockServerOperation(this.context); |
482 | 496 |
483 @override | 497 @override |
484 ServerOperationPriority get priority => ServerOperationPriority.ANALYSIS; | 498 ServerOperationPriority get priority => ServerOperationPriority.ANALYSIS; |
485 | 499 |
486 @override | 500 @override |
487 void perform(AnalysisServer server) { | 501 void perform(AnalysisServer server) { |
488 isComplete = true; | 502 isComplete = true; |
489 } | 503 } |
490 } | 504 } |
OLD | NEW |