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(sandboxDir, cachePath, "hosted", | |
17 "pub.dartlang.org", package); | |
18 } | |
19 | |
20 integration('running pub cache list when there is no cache', () { | |
21 schedulePub(args: ['cache', 'list'], output: '{"packages":{}}'); | |
22 }); | |
23 | |
24 integration('running pub cache list on empty cache', () { | |
25 // Set up a cache. | |
26 d.dir(cachePath, [ | |
27 d.dir('hosted', [ | |
28 d.dir('pub.dartlang.org', [ | |
29 ]) | |
30 ]) | |
31 ]).create(); | |
32 | |
33 schedulePub(args: ['cache', 'list'], outputJson: {"packages":{}}); | |
34 }); | |
35 | |
36 integration('running pub cache list', () { | |
37 // Set up a cache. | |
38 d.dir(cachePath, [ | |
39 d.dir('hosted', [ | |
40 d.dir('pub.dartlang.org', [ | |
41 d.dir("foo-1.2.3", [ | |
42 d.libPubspec("foo", "1.2.3"), | |
43 d.libDir("foo") | |
44 ]), | |
45 d.dir("bar-2.0.0", [ | |
46 d.libPubspec("bar", "2.0.0"), | |
47 d.libDir("bar") ]) | |
48 ]) | |
49 ]) | |
50 ]).create(); | |
51 | |
52 schedulePub(args: ['cache', 'list'], outputJson: { | |
53 "packages": { | |
54 "bar": {"2.0.0": {"location": hostedDir('bar-2.0.0')}}, | |
55 "foo": {"1.2.3": {"location": hostedDir('foo-1.2.3')}} | |
56 } | |
57 }); | |
58 }); | |
59 | |
60 integration('includes packages containing deps with bad sources', () { | |
61 // Set up a cache. | |
62 d.dir(cachePath, [ | |
63 d.dir('hosted', [ | |
64 d.dir('pub.dartlang.org', [ | |
65 d.dir("foo-1.2.3", [ | |
66 d.libPubspec("foo", "1.2.3", deps: { "bar": {"bad": "bar"}}), | |
67 d.libDir("foo") | |
68 ]) | |
69 ]) | |
70 ]) | |
71 ]).create(); | |
72 | |
73 schedulePub(args: ['cache', 'list'], outputJson: { | |
74 "packages": { | |
75 "foo": {"1.2.3": {"location": hostedDir('foo-1.2.3')}} | |
76 } | |
77 }); | |
78 }); | |
79 } | |
OLD | NEW |