OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013, 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 import 'descriptor.dart' as d; |
| 6 import 'test_pub.dart'; |
| 7 |
| 8 main() { |
| 9 initConfig(); |
| 10 forBothPubGetAndUpgrade((command) { |
| 11 integration("chooses best version matching override constraint", () { |
| 12 servePackages([ |
| 13 packageMap("foo", "1.0.0"), |
| 14 packageMap("foo", "2.0.0"), |
| 15 packageMap("foo", "3.0.0") |
| 16 ]); |
| 17 |
| 18 d.dir(appPath, [ |
| 19 d.pubspec({ |
| 20 "name": "myapp", |
| 21 "dependencies": { |
| 22 "foo": ">2.0.0" |
| 23 }, |
| 24 "dependency_overrides": { |
| 25 "foo": "<3.0.0" |
| 26 } |
| 27 }) |
| 28 ]).create(); |
| 29 |
| 30 pubCommand(command); |
| 31 |
| 32 d.packagesDir({ |
| 33 "foo": "2.0.0" |
| 34 }).validate(); |
| 35 }); |
| 36 |
| 37 integration("treats override as implicit dependency", () { |
| 38 servePackages([ |
| 39 packageMap("foo", "1.0.0") |
| 40 ]); |
| 41 |
| 42 d.dir(appPath, [ |
| 43 d.pubspec({ |
| 44 "name": "myapp", |
| 45 "dependency_overrides": { |
| 46 "foo": "any" |
| 47 } |
| 48 }) |
| 49 ]).create(); |
| 50 |
| 51 pubCommand(command); |
| 52 |
| 53 d.packagesDir({ |
| 54 "foo": "1.0.0" |
| 55 }).validate(); |
| 56 }); |
| 57 |
| 58 integration("ignores other constraints on overridden package", () { |
| 59 servePackages([ |
| 60 packageMap("foo", "1.0.0"), |
| 61 packageMap("foo", "2.0.0"), |
| 62 packageMap("foo", "3.0.0"), |
| 63 packageMap("bar", "1.0.0", {"foo": "5.0.0-nonexistent"}) |
| 64 ]); |
| 65 |
| 66 d.dir(appPath, [ |
| 67 d.pubspec({ |
| 68 "name": "myapp", |
| 69 "dependencies": { |
| 70 "bar": "any" |
| 71 }, |
| 72 "dependency_overrides": { |
| 73 "foo": "<3.0.0" |
| 74 } |
| 75 }) |
| 76 ]).create(); |
| 77 |
| 78 pubCommand(command); |
| 79 |
| 80 d.packagesDir({ |
| 81 "foo": "2.0.0", |
| 82 "bar": "1.0.0" |
| 83 }).validate(); |
| 84 }); |
| 85 |
| 86 integration("warns about overridden dependencies", () { |
| 87 servePackages([ |
| 88 packageMap("foo", "1.0.0"), |
| 89 packageMap("bar", "1.0.0"), |
| 90 packageMap("baz", "1.0.0") |
| 91 ]); |
| 92 |
| 93 d.dir(appPath, [ |
| 94 d.pubspec({ |
| 95 "name": "myapp", |
| 96 "dependency_overrides": { |
| 97 "foo": "any", |
| 98 "bar": "any", |
| 99 "baz": "any" |
| 100 } |
| 101 }) |
| 102 ]).create(); |
| 103 |
| 104 schedulePub(args: [command.name], output: command.success, error: |
| 105 """ |
| 106 Warning: You are overriding these dependencies: |
| 107 - bar any from hosted (bar) |
| 108 - baz any from hosted (baz) |
| 109 - foo any from hosted (foo) |
| 110 """); |
| 111 }); |
| 112 }); |
| 113 } |
OLD | NEW |