OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012, 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 'package:scheduled_test/scheduled_test.dart'; | |
8 | |
9 import '../../descriptor.dart' as d; | |
10 import '../../test_pub.dart'; | |
11 | |
12 main() { | |
13 initConfig(); | |
14 | |
15 integration('only requests versions that are needed during solving', () { | |
16 servePackages((builder) { | |
17 builder.serve("foo", "1.0.0"); | |
18 builder.serve("foo", "1.1.0"); | |
19 builder.serve("foo", "1.2.0"); | |
20 builder.serve("bar", "1.0.0"); | |
21 builder.serve("bar", "1.1.0"); | |
22 builder.serve("bar", "1.2.0"); | |
23 }); | |
24 | |
25 d.appDir({ | |
26 "foo": "any" | |
27 }).create(); | |
28 | |
29 // Get once so it gets cached. | |
30 pubGet(); | |
31 | |
32 // Clear the cache. We don't care about anything that was served during | |
33 // the initial get. | |
34 getRequestedPaths(); | |
35 | |
36 // Add "bar" to the dependencies. | |
37 d.appDir({ | |
38 "foo": "any", | |
39 "bar": "any" | |
40 }).create(); | |
41 | |
42 // Run the solver again. | |
43 pubGet(); | |
44 | |
45 d.packagesDir({ | |
46 "foo": "1.2.0", | |
47 "bar": "1.2.0" | |
48 }).validate(); | |
49 | |
50 // The get should not have done any network requests since the lock file is | |
51 // up to date. | |
52 getRequestedPaths().then((paths) { | |
53 expect(paths, unorderedEquals([ | |
54 // Bar should be requested because it's new, but not foo. | |
55 "api/packages/bar", | |
56 // Need to download it. | |
57 "packages/bar/versions/1.2.0.tar.gz" | |
58 ])); | |
59 }); | |
60 }); | |
61 } | |
OLD | NEW |