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