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( |
| 23 cachePath, |
| 24 [ |
| 25 d.dir( |
| 26 'hosted', |
| 27 [ |
| 28 d.async( |
| 29 port.then( |
| 30 (p) => |
| 31 d.dir( |
| 32 'localhost%58$p', |
| 33 [ |
| 34 d.dir("foo-1.2.3", [d.libPubspec("foo",
"1.2.3"), d.file("broken.txt")]), |
| 35 d.dir("foo-1.2.5", [d.libPubspec("foo",
"1.2.5"), d.file("broken.txt")]), |
| 36 d.dir( |
| 37 "bar-1.2.4", |
| 38 [d.libPubspec("bar", "1.2.4"), d.fil
e("broken.txt")])])))])]).create(); |
| 39 |
| 40 // Repair them. |
| 41 schedulePub(args: ["cache", "repair"], output: ''' |
| 42 Downloading bar 1.2.4... |
| 43 Downloading foo 1.2.3... |
| 44 Downloading foo 1.2.5... |
| 45 Reinstalled 3 packages.'''); |
| 46 |
| 47 // The broken versions should have been replaced. |
| 48 d.hostedCache( |
| 49 [ |
| 50 d.dir("bar-1.2.4", [d.nothing("broken.txt")]), |
| 51 d.dir("foo-1.2.3", [d.nothing("broken.txt")]), |
| 52 d.dir("foo-1.2.5", [d.nothing("broken.txt")])]).validate(); |
| 53 }); |
| 54 } |
OLD | NEW |