| 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.resolver.package; | 5 library test.resolver.package; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/package_uri_resolver.dart'; | 7 import 'package:analysis_server/src/package_uri_resolver.dart'; |
| 8 import 'package:analysis_server/src/resource.dart'; | 8 import 'package:analysis_server/src/resource.dart'; |
| 9 import 'package:analyzer/src/generated/source.dart'; | 9 import 'package:analyzer/src/generated/source.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 void test_fromEncoding_package() { | 47 void test_fromEncoding_package() { |
| 48 UriResolver resolver = new PackageMapUriResolver(provider, EMPTY_MAP); | 48 UriResolver resolver = new PackageMapUriResolver(provider, EMPTY_MAP); |
| 49 Uri uri = Uri.parse('package:/does/not/exist.dart'); | 49 Uri uri = Uri.parse('package:/does/not/exist.dart'); |
| 50 Source result = resolver.fromEncoding(UriKind.PACKAGE_URI, uri); | 50 Source result = resolver.fromEncoding(UriKind.PACKAGE_URI, uri); |
| 51 expect(result, isNotNull); | 51 expect(result, isNotNull); |
| 52 expect(result.fullName, '/does/not/exist.dart'); | 52 expect(result.fullName, '/does/not/exist.dart'); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void test_fromEncoding_packageSelf() { | |
| 56 UriResolver resolver = new PackageMapUriResolver(provider, EMPTY_MAP); | |
| 57 Uri uri = Uri.parse('package:/does/not/exist.dart'); | |
| 58 Source result = resolver.fromEncoding(UriKind.PACKAGE_SELF_URI, uri); | |
| 59 expect(result, isNotNull); | |
| 60 expect(result.fullName, '/does/not/exist.dart'); | |
| 61 } | |
| 62 | |
| 63 void test_isPackageUri_null_scheme() { | 55 void test_isPackageUri_null_scheme() { |
| 64 Uri uri = Uri.parse('foo.dart'); | 56 Uri uri = Uri.parse('foo.dart'); |
| 65 expect(uri.scheme, ''); | 57 expect(uri.scheme, ''); |
| 66 expect(PackageMapUriResolver.isPackageUri(uri), isFalse); | 58 expect(PackageMapUriResolver.isPackageUri(uri), isFalse); |
| 67 } | 59 } |
| 68 | 60 |
| 69 void test_isPackageUri_other_scheme() { | 61 void test_isPackageUri_other_scheme() { |
| 70 Uri uri = Uri.parse('memfs:/foo.dart'); | 62 Uri uri = Uri.parse('memfs:/foo.dart'); |
| 71 expect(uri.scheme, 'memfs'); | 63 expect(uri.scheme, 'memfs'); |
| 72 expect(PackageMapUriResolver.isPackageUri(uri), isFalse); | 64 expect(PackageMapUriResolver.isPackageUri(uri), isFalse); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 122 |
| 131 void test_resolve_package_notInMap() { | 123 void test_resolve_package_notInMap() { |
| 132 UriResolver resolver = new PackageMapUriResolver(provider, EMPTY_MAP); | 124 UriResolver resolver = new PackageMapUriResolver(provider, EMPTY_MAP); |
| 133 Uri uri = Uri.parse('package:analyzer/analyzer.dart'); | 125 Uri uri = Uri.parse('package:analyzer/analyzer.dart'); |
| 134 Source result = resolver.resolveAbsolute(uri); | 126 Source result = resolver.resolveAbsolute(uri); |
| 135 expect(result, isNotNull); | 127 expect(result, isNotNull); |
| 136 expect(result.exists(), isFalse); | 128 expect(result.exists(), isFalse); |
| 137 expect(result.fullName, 'package:analyzer/analyzer.dart'); | 129 expect(result.fullName, 'package:analyzer/analyzer.dart'); |
| 138 } | 130 } |
| 139 } | 131 } |
| OLD | NEW |