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 test.source.sdk_ext; | 5 library test.source.sdk_ext; |
6 | 6 |
7 import 'package:analyzer/file_system/file_system.dart'; | |
8 import 'package:analyzer/file_system/memory_file_system.dart'; | 7 import 'package:analyzer/file_system/memory_file_system.dart'; |
9 import 'package:analyzer/source/sdk_ext.dart'; | 8 import 'package:analyzer/source/sdk_ext.dart'; |
10 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
11 | 10 |
12 MemoryResourceProvider resourceProvider; | |
13 | |
14 buildResourceProvider() { | |
15 resourceProvider = new MemoryResourceProvider(); | |
16 resourceProvider.newFolder('/empty'); | |
17 resourceProvider.newFolder('/tmp'); | |
18 resourceProvider.newFile('/tmp/_sdkext', r''' | |
19 { | |
20 "dart:fox": "slippy.dart", | |
21 "dart:bear": "grizzly.dart", | |
22 "dart:relative": "../relative.dart", | |
23 "dart:deep": "deep/directory/file.dart", | |
24 "fart:loudly": "nomatter.dart" | |
25 }'''); | |
26 } | |
27 | |
28 clearResourceProvider() { | |
29 resourceProvider = null; | |
30 } | |
31 | |
32 main() { | 11 main() { |
33 groupSep = ' | '; | 12 groupSep = ' | '; |
34 group('SdkExtUriResolverTest', () { | 13 group('SdkExtUriResolverTest', () { |
35 setUp(() { | 14 setUp(() { |
36 buildResourceProvider(); | 15 buildResourceProvider(); |
37 }); | 16 }); |
38 tearDown(() { | 17 tearDown(() { |
39 clearResourceProvider(); | 18 clearResourceProvider(); |
40 }); | 19 }); |
41 test('test_NullPackageMap', () { | 20 test('test_NullPackageMap', () { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // Restore source's uri. | 67 // Restore source's uri. |
89 var restoreUri = resolver.restoreAbsolute(source); | 68 var restoreUri = resolver.restoreAbsolute(source); |
90 expect(restoreUri, isNotNull); | 69 expect(restoreUri, isNotNull); |
91 // Verify that it is 'dart:fox/foo.dart'. | 70 // Verify that it is 'dart:fox/foo.dart'. |
92 expect(restoreUri.toString(), equals('dart:fox/foo.dart')); | 71 expect(restoreUri.toString(), equals('dart:fox/foo.dart')); |
93 expect(restoreUri.scheme, equals('dart')); | 72 expect(restoreUri.scheme, equals('dart')); |
94 expect(restoreUri.path, equals('fox/foo.dart')); | 73 expect(restoreUri.path, equals('fox/foo.dart')); |
95 }); | 74 }); |
96 }); | 75 }); |
97 } | 76 } |
| 77 |
| 78 MemoryResourceProvider resourceProvider; |
| 79 |
| 80 buildResourceProvider() { |
| 81 resourceProvider = new MemoryResourceProvider(); |
| 82 resourceProvider.newFolder('/empty'); |
| 83 resourceProvider.newFolder('/tmp'); |
| 84 resourceProvider.newFile('/tmp/_sdkext', r''' |
| 85 { |
| 86 "dart:fox": "slippy.dart", |
| 87 "dart:bear": "grizzly.dart", |
| 88 "dart:relative": "../relative.dart", |
| 89 "dart:deep": "deep/directory/file.dart", |
| 90 "fart:loudly": "nomatter.dart" |
| 91 }'''); |
| 92 } |
| 93 |
| 94 clearResourceProvider() { |
| 95 resourceProvider = null; |
| 96 } |
OLD | NEW |