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