OLD | NEW |
| 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 |
1 library pub_tests; | 5 library pub_tests; |
| 6 |
2 import '../descriptor.dart' as d; | 7 import '../descriptor.dart' as d; |
3 import '../test_pub.dart'; | 8 import '../test_pub.dart'; |
| 9 |
4 main() { | 10 main() { |
5 initConfig(); | 11 initConfig(); |
| 12 |
6 forBothPubGetAndUpgrade((command) { | 13 forBothPubGetAndUpgrade((command) { |
7 integration('upgrades a package using the cache', () { | 14 integration('upgrades a package using the cache', () { |
| 15 // Run the server so that we know what URL to use in the system cache. |
8 serveNoPackages(); | 16 serveNoPackages(); |
| 17 |
9 d.cacheDir({ | 18 d.cacheDir({ |
10 "foo": ["1.2.2", "1.2.3"], | 19 "foo": ["1.2.2", "1.2.3"], |
11 "bar": ["1.2.3"] | 20 "bar": ["1.2.3"] |
12 }, includePubspecs: true).create(); | 21 }, includePubspecs: true).create(); |
| 22 |
13 d.appDir({ | 23 d.appDir({ |
14 "foo": "any", | 24 "foo": "any", |
15 "bar": "any" | 25 "bar": "any" |
16 }).create(); | 26 }).create(); |
| 27 |
17 var warning = null; | 28 var warning = null; |
18 if (command == RunCommand.upgrade) { | 29 if (command == RunCommand.upgrade) { |
19 warning = | 30 warning = |
20 "Warning: Upgrading when offline may not update you " | 31 "Warning: Upgrading when offline may not update you " |
21 "to the latest versions of your dependencies."; | 32 "to the latest versions of your dependencies."; |
22 } | 33 } |
| 34 |
23 pubCommand(command, args: ['--offline'], warning: warning); | 35 pubCommand(command, args: ['--offline'], warning: warning); |
| 36 |
24 d.packagesDir({ | 37 d.packagesDir({ |
25 "foo": "1.2.3", | 38 "foo": "1.2.3", |
26 "bar": "1.2.3" | 39 "bar": "1.2.3" |
27 }).validate(); | 40 }).validate(); |
28 }); | 41 }); |
| 42 |
29 integration('fails gracefully if a dependency is not cached', () { | 43 integration('fails gracefully if a dependency is not cached', () { |
| 44 // Run the server so that we know what URL to use in the system cache. |
30 serveNoPackages(); | 45 serveNoPackages(); |
| 46 |
31 d.appDir({ | 47 d.appDir({ |
32 "foo": "any" | 48 "foo": "any" |
33 }).create(); | 49 }).create(); |
| 50 |
34 pubCommand( | 51 pubCommand( |
35 command, | 52 command, |
36 args: ['--offline'], | 53 args: ['--offline'], |
37 error: "Could not find package foo in cache."); | 54 error: "Could not find package foo in cache."); |
38 }); | 55 }); |
| 56 |
39 integration('fails gracefully no cached versions match', () { | 57 integration('fails gracefully no cached versions match', () { |
| 58 // Run the server so that we know what URL to use in the system cache. |
40 serveNoPackages(); | 59 serveNoPackages(); |
| 60 |
41 d.cacheDir({ | 61 d.cacheDir({ |
42 "foo": ["1.2.2", "1.2.3"] | 62 "foo": ["1.2.2", "1.2.3"] |
43 }, includePubspecs: true).create(); | 63 }, includePubspecs: true).create(); |
| 64 |
44 d.appDir({ | 65 d.appDir({ |
45 "foo": ">2.0.0" | 66 "foo": ">2.0.0" |
46 }).create(); | 67 }).create(); |
| 68 |
47 pubCommand( | 69 pubCommand( |
48 command, | 70 command, |
49 args: ['--offline'], | 71 args: ['--offline'], |
50 error: "Package foo has no versions that match >2.0.0 derived from:\n" | 72 error: "Package foo has no versions that match >2.0.0 derived from:\n" |
51 "- myapp 0.0.0 depends on version >2.0.0"); | 73 "- myapp 0.0.0 depends on version >2.0.0"); |
52 }); | 74 }); |
53 }); | 75 }); |
54 } | 76 } |
OLD | NEW |