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 analyzer.test.file_system.resource_uri_resolver_test; | 5 library analyzer.test.file_system.resource_uri_resolver_test; |
6 | 6 |
7 import 'package:analyzer/file_system/file_system.dart'; | 7 import 'package:analyzer/file_system/file_system.dart'; |
8 import 'package:analyzer/file_system/memory_file_system.dart'; | 8 import 'package:analyzer/file_system/memory_file_system.dart'; |
9 import 'package:analyzer/src/generated/source.dart'; | 9 import 'package:analyzer/src/generated/source.dart'; |
| 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
10 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
11 | 12 |
12 import '../reflective_tests.dart'; | |
13 import '../utils.dart'; | 13 import '../utils.dart'; |
14 | 14 |
15 main() { | 15 main() { |
16 initializeTestEnvironment(); | 16 initializeTestEnvironment(); |
17 runReflectiveTests(ResourceUriResolverTest); | 17 defineReflectiveTests(ResourceUriResolverTest); |
18 } | 18 } |
19 | 19 |
20 @reflectiveTest | 20 @reflectiveTest |
21 class ResourceUriResolverTest { | 21 class ResourceUriResolverTest { |
22 MemoryResourceProvider provider; | 22 MemoryResourceProvider provider; |
23 ResourceUriResolver resolver; | 23 ResourceUriResolver resolver; |
24 | 24 |
25 void setUp() { | 25 void setUp() { |
26 provider = new MemoryResourceProvider(); | 26 provider = new MemoryResourceProvider(); |
27 resolver = new ResourceUriResolver(provider); | 27 resolver = new ResourceUriResolver(provider); |
(...skipping 13 matching lines...) Expand all Loading... |
41 expect(source.exists(), isTrue); | 41 expect(source.exists(), isTrue); |
42 expect(source.fullName, '/test.dart'); | 42 expect(source.fullName, '/test.dart'); |
43 } | 43 } |
44 | 44 |
45 void test_resolveAbsolute_folder() { | 45 void test_resolveAbsolute_folder() { |
46 var uri = new Uri(scheme: 'file', path: '/folder'); | 46 var uri = new Uri(scheme: 'file', path: '/folder'); |
47 Source source = resolver.resolveAbsolute(uri); | 47 Source source = resolver.resolveAbsolute(uri); |
48 expect(source, isNull); | 48 expect(source, isNull); |
49 } | 49 } |
50 | 50 |
| 51 void test_resolveAbsolute_notFile_dartUri() { |
| 52 var uri = new Uri(scheme: 'dart', path: 'core'); |
| 53 Source source = resolver.resolveAbsolute(uri); |
| 54 expect(source, isNull); |
| 55 } |
| 56 |
51 void test_resolveAbsolute_notFile_httpsUri() { | 57 void test_resolveAbsolute_notFile_httpsUri() { |
52 var uri = new Uri(scheme: 'https', path: '127.0.0.1/test.dart'); | 58 var uri = new Uri(scheme: 'https', path: '127.0.0.1/test.dart'); |
53 Source source = resolver.resolveAbsolute(uri); | 59 Source source = resolver.resolveAbsolute(uri); |
54 expect(source, isNull); | 60 expect(source, isNull); |
55 } | 61 } |
56 | |
57 void test_resolveAbsolute_notFile_dartUri() { | |
58 var uri = new Uri(scheme: 'dart', path: 'core'); | |
59 Source source = resolver.resolveAbsolute(uri); | |
60 expect(source, isNull); | |
61 } | |
62 | 62 |
63 void test_restoreAbsolute() { | 63 void test_restoreAbsolute() { |
64 var uri = new Uri(scheme: 'file', path: '/test.dart'); | 64 var uri = new Uri(scheme: 'file', path: '/test.dart'); |
65 Source source = resolver.resolveAbsolute(uri); | 65 Source source = resolver.resolveAbsolute(uri); |
66 expect(source, isNotNull); | 66 expect(source, isNotNull); |
67 expect(resolver.restoreAbsolute(source), uri); | 67 expect(resolver.restoreAbsolute(source), uri); |
68 expect( | 68 expect( |
69 resolver.restoreAbsolute( | 69 resolver.restoreAbsolute( |
70 new NonExistingSource(source.fullName, null, null)), | 70 new NonExistingSource(source.fullName, null, null)), |
71 uri); | 71 uri); |
72 } | 72 } |
73 } | 73 } |
OLD | NEW |