OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analyzer.test.generated.test.generated.source_factory; | 5 library analyzer.test.generated.test.generated.source_factory; |
6 | 6 |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
8 | 8 |
9 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
10 import 'package:analyzer/file_system/memory_file_system.dart'; | 10 import 'package:analyzer/file_system/memory_file_system.dart'; |
11 import 'package:analyzer/source/package_map_resolver.dart'; | 11 import 'package:analyzer/source/package_map_resolver.dart'; |
12 import 'package:analyzer/src/generated/engine.dart' show AnalysisEngine, Logger; | 12 import 'package:analyzer/src/generated/engine.dart' show AnalysisEngine, Logger; |
13 import 'package:analyzer/src/generated/java_engine_io.dart'; | 13 import 'package:analyzer/src/generated/java_engine_io.dart'; |
14 import 'package:analyzer/src/generated/source.dart'; | 14 import 'package:analyzer/src/generated/source.dart'; |
15 import 'package:analyzer/src/generated/source_io.dart'; | 15 import 'package:analyzer/src/generated/source_io.dart'; |
16 import 'package:analyzer/src/generated/utilities_dart.dart' as utils; | 16 import 'package:analyzer/src/generated/utilities_dart.dart' as utils; |
17 import 'package:analyzer/src/source/source_resource.dart'; | 17 import 'package:analyzer/src/source/source_resource.dart'; |
18 import 'package:package_config/packages.dart'; | 18 import 'package:package_config/packages.dart'; |
19 import 'package:package_config/packages_file.dart' as pkgfile show parse; | 19 import 'package:package_config/packages_file.dart' as pkgfile show parse; |
20 import 'package:package_config/src/packages_impl.dart'; | 20 import 'package:package_config/src/packages_impl.dart'; |
21 import 'package:path/path.dart'; | 21 import 'package:path/path.dart' as pathos; |
22 import 'package:test/test.dart'; | 22 import 'package:test/test.dart'; |
23 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 23 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
24 | 24 |
25 import 'test_support.dart'; | 25 import 'test_support.dart'; |
26 | 26 |
27 main() { | 27 main() { |
28 runPackageMapTests(); | 28 runPackageMapTests(); |
29 defineReflectiveSuite(() { | 29 defineReflectiveSuite(() { |
30 defineReflectiveTests(SourceFactoryTest); | 30 defineReflectiveTests(SourceFactoryTest); |
31 }); | 31 }); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 new SourceFactory([new AbsoluteUriResolver(resourceProvider)]); | 277 new SourceFactory([new AbsoluteUriResolver(resourceProvider)]); |
278 Source containingSource = | 278 Source containingSource = |
279 new FileSource(resourceProvider.getFile("/does/not/have.dart")); | 279 new FileSource(resourceProvider.getFile("/does/not/have.dart")); |
280 Source result = factory.resolveUri(containingSource, "exist.dart"); | 280 Source result = factory.resolveUri(containingSource, "exist.dart"); |
281 expect(result.fullName, | 281 expect(result.fullName, |
282 FileUtilities2.createFile("/does/not/exist.dart").getAbsolutePath()); | 282 FileUtilities2.createFile("/does/not/exist.dart").getAbsolutePath()); |
283 } | 283 } |
284 | 284 |
285 void test_resolveUri_nonAbsolute_relative_package() { | 285 void test_resolveUri_nonAbsolute_relative_package() { |
286 MemoryResourceProvider provider = new MemoryResourceProvider(); | 286 MemoryResourceProvider provider = new MemoryResourceProvider(); |
287 Context context = provider.pathContext; | 287 pathos.Context context = provider.pathContext; |
288 String packagePath = | 288 String packagePath = |
289 context.joinAll([context.separator, 'path', 'to', 'package']); | 289 context.joinAll([context.separator, 'path', 'to', 'package']); |
290 String libPath = context.joinAll([packagePath, 'lib']); | 290 String libPath = context.joinAll([packagePath, 'lib']); |
291 String dirPath = context.joinAll([libPath, 'dir']); | 291 String dirPath = context.joinAll([libPath, 'dir']); |
292 String firstPath = context.joinAll([dirPath, 'first.dart']); | 292 String firstPath = context.joinAll([dirPath, 'first.dart']); |
293 String secondPath = context.joinAll([dirPath, 'second.dart']); | 293 String secondPath = context.joinAll([dirPath, 'second.dart']); |
294 | 294 |
295 provider.newFolder(packagePath); | 295 provider.newFolder(packagePath); |
296 Folder libFolder = provider.newFolder(libPath); | 296 Folder libFolder = provider.newFolder(libPath); |
297 provider.newFolder(dirPath); | 297 provider.newFolder(dirPath); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 UriResolver_SourceFactoryTest_test_fromEncoding_valid(this.encoding); | 359 UriResolver_SourceFactoryTest_test_fromEncoding_valid(this.encoding); |
360 | 360 |
361 @override | 361 @override |
362 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 362 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
363 if (uri.toString() == encoding) { | 363 if (uri.toString() == encoding) { |
364 return new TestSource(); | 364 return new TestSource(); |
365 } | 365 } |
366 return null; | 366 return null; |
367 } | 367 } |
368 } | 368 } |
OLD | NEW |