OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 library pub_cache_test; | |
6 | |
7 import 'package:path/path.dart' as path; | |
8 | |
9 import '../descriptor.dart' as d; | |
10 import '../test_pub.dart'; | |
11 | |
12 main() { | |
13 initConfig(); | |
14 | |
15 hostedDir(package) { | |
16 return path.join( | |
17 sandboxDir, | |
18 cachePath, | |
19 "hosted", | |
20 "pub.dartlang.org", | |
21 package); | |
22 } | |
23 | |
24 integration('running pub cache list when there is no cache', () { | |
25 schedulePub(args: ['cache', 'list'], output: '{"packages":{}}'); | |
26 }); | |
27 | |
28 integration('running pub cache list on empty cache', () { | |
29 // Set up a cache. | |
30 d.dir( | |
31 cachePath, | |
32 [d.dir('hosted', [d.dir('pub.dartlang.org', [])])]).create(); | |
33 | |
34 schedulePub(args: ['cache', 'list'], outputJson: { | |
35 "packages": {} | |
36 }); | |
37 }); | |
38 | |
39 integration('running pub cache list', () { | |
40 // Set up a cache. | |
41 d.dir( | |
42 cachePath, | |
43 [ | |
44 d.dir( | |
45 'hosted', | |
46 [ | |
47 d.dir( | |
48 'pub.dartlang.org', | |
49 [ | |
50 d.dir("foo-1.2.3", [d.libPubspec("foo", "1.2.3"), d.
libDir("foo")]), | |
51 d.dir( | |
52 "bar-2.0.0", | |
53 [d.libPubspec("bar", "2.0.0"), d.libDir("bar")])
])])]).create(); | |
54 | |
55 schedulePub(args: ['cache', 'list'], outputJson: { | |
56 "packages": { | |
57 "bar": { | |
58 "2.0.0": { | |
59 "location": hostedDir('bar-2.0.0') | |
60 } | |
61 }, | |
62 "foo": { | |
63 "1.2.3": { | |
64 "location": hostedDir('foo-1.2.3') | |
65 } | |
66 } | |
67 } | |
68 }); | |
69 }); | |
70 | |
71 integration('includes packages containing deps with bad sources', () { | |
72 // Set up a cache. | |
73 d.dir( | |
74 cachePath, | |
75 [ | |
76 d.dir( | |
77 'hosted', | |
78 [ | |
79 d.dir( | |
80 'pub.dartlang.org', | |
81 [d.dir("foo-1.2.3", [d.libPubspec("foo", "1.2.3", deps:
{ | |
82 "bar": { | |
83 "bad": "bar" | |
84 } | |
85 }), d.libDir("foo")])])])]).create(); | |
86 | |
87 schedulePub(args: ['cache', 'list'], outputJson: { | |
88 "packages": { | |
89 "foo": { | |
90 "1.2.3": { | |
91 "location": hostedDir('foo-1.2.3') | |
92 } | |
93 } | |
94 } | |
95 }); | |
96 }); | |
97 } | |
OLD | NEW |