| 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('installs 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: ['install', '--offline'], | |
| 29 output: new RegExp("Dependencies installed!\$")); | |
| 30 | |
| 31 d.packagesDir({ | |
| 32 "foo": "1.2.3", | |
| 33 "bar": "1.2.3" | |
| 34 }).validate(); | |
| 35 }); | |
| 36 | |
| 37 integration('fails gracefully if a dependency is not cached', () { | |
| 38 // Run the server so that we know what URL to use in the system cache. | |
| 39 servePackages([]); | |
| 40 | |
| 41 d.appDir([ | |
| 42 dependencyMap("foo", "any") | |
| 43 ]).create(); | |
| 44 | |
| 45 schedulePub(args: ['install', '--offline'], | |
| 46 error: new RegExp('Could not find package "foo" in cache'), | |
| 47 exitCode: 1); | |
| 48 }); | |
| 49 | |
| 50 integration('fails gracefully no cached versions match', () { | |
| 51 // Run the server so that we know what URL to use in the system cache. | |
| 52 servePackages([]); | |
| 53 | |
| 54 d.cacheDir({ | |
| 55 "foo": ["1.2.2", "1.2.3"] | |
| 56 }, includePubspecs: true).create(); | |
| 57 | |
| 58 d.appDir([ | |
| 59 dependencyMap("foo", ">2.0.0") | |
| 60 ]).create(); | |
| 61 | |
| 62 schedulePub(args: ['install', '--offline'], | |
| 63 error: new RegExp("Package 'foo' has no versions that match >2.0.0"), | |
| 64 exitCode: 1); | |
| 65 }); | |
| 66 } | |
| OLD | NEW |