| 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 'package:path/path.dart' as path; | |
| 6 | |
| 7 import 'descriptor.dart' as d; | |
| 8 import 'test_pub.dart'; | |
| 9 | |
| 10 main() { | |
| 11 initConfig(); | |
| 12 forBothPubGetAndUpgrade((command) { | |
| 13 integration("chooses best version matching override constraint", () { | |
| 14 servePackages((builder) { | |
| 15 builder.serve("foo", "1.0.0"); | |
| 16 builder.serve("foo", "2.0.0"); | |
| 17 builder.serve("foo", "3.0.0"); | |
| 18 }); | |
| 19 | |
| 20 d.dir(appPath, [d.pubspec({ | |
| 21 "name": "myapp", | |
| 22 "dependencies": { | |
| 23 "foo": ">2.0.0" | |
| 24 }, | |
| 25 "dependency_overrides": { | |
| 26 "foo": "<3.0.0" | |
| 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((builder) { | |
| 39 builder.serve("foo", "1.0.0"); | |
| 40 }); | |
| 41 | |
| 42 d.dir(appPath, [d.pubspec({ | |
| 43 "name": "myapp", | |
| 44 "dependency_overrides": { | |
| 45 "foo": "any" | |
| 46 } | |
| 47 })]).create(); | |
| 48 | |
| 49 pubCommand(command); | |
| 50 | |
| 51 d.packagesDir({ | |
| 52 "foo": "1.0.0" | |
| 53 }).validate(); | |
| 54 }); | |
| 55 | |
| 56 integration("ignores other constraints on overridden package", () { | |
| 57 servePackages((builder) { | |
| 58 builder.serve("foo", "1.0.0"); | |
| 59 builder.serve("foo", "2.0.0"); | |
| 60 builder.serve("foo", "3.0.0"); | |
| 61 builder.serve("bar", "1.0.0", pubspec: { | |
| 62 "dependencies": { | |
| 63 "foo": "5.0.0-nonexistent" | |
| 64 } | |
| 65 }); | |
| 66 }); | |
| 67 | |
| 68 d.dir(appPath, [d.pubspec({ | |
| 69 "name": "myapp", | |
| 70 "dependencies": { | |
| 71 "bar": "any" | |
| 72 }, | |
| 73 "dependency_overrides": { | |
| 74 "foo": "<3.0.0" | |
| 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((builder) { | |
| 88 builder.serve("foo", "1.0.0"); | |
| 89 builder.serve("bar", "1.0.0"); | |
| 90 }); | |
| 91 | |
| 92 d.dir("baz", [d.libDir("baz"), d.libPubspec("baz", "0.0.1")]).create(); | |
| 93 | |
| 94 d.dir(appPath, [d.pubspec({ | |
| 95 "name": "myapp", | |
| 96 "dependency_overrides": { | |
| 97 "foo": "any", | |
| 98 "bar": "any", | |
| 99 "baz": { | |
| 100 "path": "../baz" | |
| 101 } | |
| 102 } | |
| 103 })]).create(); | |
| 104 | |
| 105 var bazPath = path.join("..", "baz"); | |
| 106 | |
| 107 schedulePub(args: [command.name], output: command.success, error: """ | |
| 108 Warning: You are using these overridden dependencies: | |
| 109 ! bar 1.0.0 | |
| 110 ! baz 0.0.1 from path $bazPath | |
| 111 ! foo 1.0.0 | |
| 112 """); | |
| 113 }); | |
| 114 }); | |
| 115 } | |
| OLD | NEW |