OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 library pub_tests; | |
6 | |
7 import '../../descriptor.dart' as d; | |
8 import '../../test_pub.dart'; | |
9 | |
10 main() { | |
11 initConfig(); | |
12 integration('reinstalls previously cached hosted packages', () { | |
13 servePackages((builder) { | |
14 builder.serve("foo", "1.2.3"); | |
15 builder.serve("foo", "1.2.4"); | |
16 builder.serve("foo", "1.2.5"); | |
17 builder.serve("bar", "1.2.3"); | |
18 builder.serve("bar", "1.2.4"); | |
19 }); | |
20 | |
21 // Set up a cache with some broken packages. | |
22 d.dir(cachePath, [ | |
23 d.dir('hosted', [ | |
24 d.async(port.then((p) => d.dir('localhost%58$p', [ | |
25 d.dir("foo-1.2.3", [ | |
26 d.libPubspec("foo", "1.2.3"), | |
27 d.file("broken.txt") | |
28 ]), | |
29 d.dir("foo-1.2.5", [ | |
30 d.libPubspec("foo", "1.2.5"), | |
31 d.file("broken.txt") | |
32 ]), | |
33 d.dir("bar-1.2.4", [ | |
34 d.libPubspec("bar", "1.2.4"), | |
35 d.file("broken.txt") | |
36 ]) | |
37 ]))) | |
38 ]) | |
39 ]).create(); | |
40 | |
41 // Repair them. | |
42 schedulePub(args: ["cache", "repair"], | |
43 output: ''' | |
44 Downloading bar 1.2.4... | |
45 Downloading foo 1.2.3... | |
46 Downloading foo 1.2.5... | |
47 Reinstalled 3 packages.'''); | |
48 | |
49 // The broken versions should have been replaced. | |
50 d.hostedCache([ | |
51 d.dir("bar-1.2.4", [d.nothing("broken.txt")]), | |
52 d.dir("foo-1.2.3", [d.nothing("broken.txt")]), | |
53 d.dir("foo-1.2.5", [d.nothing("broken.txt")]) | |
54 ]).validate(); | |
55 }); | |
56 } | |
OLD | NEW |