OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.package_test; | 5 library analyzer.test.generated.package_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/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
10 import 'package:analyzer/src/generated/package.dart'; | 10 import 'package:analyzer/src/generated/package.dart'; |
(...skipping 14 matching lines...) Expand all Loading... |
25 defineReflectiveTests(PackageManagerTest); | 25 defineReflectiveTests(PackageManagerTest); |
26 } | 26 } |
27 | 27 |
28 /** | 28 /** |
29 * The name of the pubspec.yaml file. | 29 * The name of the pubspec.yaml file. |
30 */ | 30 */ |
31 const String pubspecName = 'pubspec.yaml'; | 31 const String pubspecName = 'pubspec.yaml'; |
32 | 32 |
33 @reflectiveTest | 33 @reflectiveTest |
34 class DependencyFinderTest extends ResolverTestCase { | 34 class DependencyFinderTest extends ResolverTestCase { |
35 /** | |
36 * The resource provider to be used by tests. | |
37 */ | |
38 MemoryResourceProvider resourceProvider; | |
39 | |
40 @override | |
41 void setUp() { | |
42 resourceProvider = new MemoryResourceProvider(); | |
43 } | |
44 | |
45 void test_transitiveDependenciesFor_circularDependencies() { | 35 void test_transitiveDependenciesFor_circularDependencies() { |
46 String packageA = '/pub-cache/a-1.0'; | 36 String packageA = '/pub-cache/a-1.0'; |
47 String packageB = '/pub-cache/b-1.0'; | 37 String packageB = '/pub-cache/b-1.0'; |
48 String packageC = '/pub-cache/c-1.0'; | 38 String packageC = '/pub-cache/c-1.0'; |
49 resourceProvider.newFile( | 39 resourceProvider.newFile( |
50 '$packageA/$pubspecName', | 40 '$packageA/$pubspecName', |
51 ''' | 41 ''' |
52 dependencies: | 42 dependencies: |
53 b: any | 43 b: any |
54 '''); | 44 '''); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 DartSdk sdk = new MockSdk(); | 195 DartSdk sdk = new MockSdk(); |
206 AnalysisOptions options = new AnalysisOptionsImpl(); | 196 AnalysisOptions options = new AnalysisOptionsImpl(); |
207 PackageDescription first = new PackageDescription(packageId, sdk, options); | 197 PackageDescription first = new PackageDescription(packageId, sdk, options); |
208 PackageDescription second = new PackageDescription(packageId, sdk, options); | 198 PackageDescription second = new PackageDescription(packageId, sdk, options); |
209 expect(first == second, isTrue); | 199 expect(first == second, isTrue); |
210 } | 200 } |
211 } | 201 } |
212 | 202 |
213 @reflectiveTest | 203 @reflectiveTest |
214 class PackageManagerTest extends ResolverTestCase { | 204 class PackageManagerTest extends ResolverTestCase { |
215 /** | |
216 * The resource provider to be used by tests. | |
217 */ | |
218 MemoryResourceProvider resourceProvider; | |
219 | |
220 @override | |
221 void setUp() { | |
222 resourceProvider = new MemoryResourceProvider(); | |
223 } | |
224 | |
225 void test_getContext() { | 205 void test_getContext() { |
226 String packageA = '/pub-cache/a-1.0'; | 206 String packageA = '/pub-cache/a-1.0'; |
227 String packageB1 = '/pub-cache/b-1.0'; | 207 String packageB1 = '/pub-cache/b-1.0'; |
228 String packageB2 = '/pub-cache/b-2.0'; | 208 String packageB2 = '/pub-cache/b-2.0'; |
229 String packageC = '/pub-cache/c-1.0'; | 209 String packageC = '/pub-cache/c-1.0'; |
230 resourceProvider.newFile( | 210 resourceProvider.newFile( |
231 '$packageA/$pubspecName', | 211 '$packageA/$pubspecName', |
232 ''' | 212 ''' |
233 dependencies: | 213 dependencies: |
234 b: any | 214 b: any |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 265 |
286 @override | 266 @override |
287 Map<String, Uri> asMap() => map; | 267 Map<String, Uri> asMap() => map; |
288 | 268 |
289 @override | 269 @override |
290 Uri resolve(Uri packageUri, {Uri notFound(Uri packageUri)}) { | 270 Uri resolve(Uri packageUri, {Uri notFound(Uri packageUri)}) { |
291 fail('Unexpected invocation of resolve'); | 271 fail('Unexpected invocation of resolve'); |
292 return null; | 272 return null; |
293 } | 273 } |
294 } | 274 } |
OLD | NEW |