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, [ | |
21 d.pubspec({ | |
22 "name": "myapp", | |
23 "dependencies": { | |
24 "foo": ">2.0.0" | |
25 }, | |
26 "dependency_overrides": { | |
27 "foo": "<3.0.0" | |
28 } | |
29 }) | |
30 ]).create(); | |
31 | |
32 pubCommand(command); | |
33 | |
34 d.packagesDir({ | |
35 "foo": "2.0.0" | |
36 }).validate(); | |
37 }); | |
38 | |
39 integration("treats override as implicit dependency", () { | |
40 servePackages((builder) { | |
41 builder.serve("foo", "1.0.0"); | |
42 }); | |
43 | |
44 d.dir(appPath, [ | |
45 d.pubspec({ | |
46 "name": "myapp", | |
47 "dependency_overrides": { | |
48 "foo": "any" | |
49 } | |
50 }) | |
51 ]).create(); | |
52 | |
53 pubCommand(command); | |
54 | |
55 d.packagesDir({ | |
56 "foo": "1.0.0" | |
57 }).validate(); | |
58 }); | |
59 | |
60 integration("ignores other constraints on overridden package", () { | |
61 servePackages((builder) { | |
62 builder.serve("foo", "1.0.0"); | |
63 builder.serve("foo", "2.0.0"); | |
64 builder.serve("foo", "3.0.0"); | |
65 builder.serve("bar", "1.0.0", pubspec: { | |
66 "dependencies": {"foo": "5.0.0-nonexistent"} | |
67 }); | |
68 }); | |
69 | |
70 d.dir(appPath, [ | |
71 d.pubspec({ | |
72 "name": "myapp", | |
73 "dependencies": { | |
74 "bar": "any" | |
75 }, | |
76 "dependency_overrides": { | |
77 "foo": "<3.0.0" | |
78 } | |
79 }) | |
80 ]).create(); | |
81 | |
82 pubCommand(command); | |
83 | |
84 d.packagesDir({ | |
85 "foo": "2.0.0", | |
86 "bar": "1.0.0" | |
87 }).validate(); | |
88 }); | |
89 | |
90 integration("warns about overridden dependencies", () { | |
91 servePackages((builder) { | |
92 builder.serve("foo", "1.0.0"); | |
93 builder.serve("bar", "1.0.0"); | |
94 }); | |
95 | |
96 d.dir("baz", [ | |
97 d.libDir("baz"), | |
98 d.libPubspec("baz", "0.0.1") | |
99 ]).create(); | |
100 | |
101 d.dir(appPath, [ | |
102 d.pubspec({ | |
103 "name": "myapp", | |
104 "dependency_overrides": { | |
105 "foo": "any", | |
106 "bar": "any", | |
107 "baz": {"path": "../baz"} | |
108 } | |
109 }) | |
110 ]).create(); | |
111 | |
112 var bazPath = path.join("..", "baz"); | |
113 | |
114 schedulePub(args: [command.name], output: command.success, error: | |
115 """ | |
116 Warning: You are using these overridden dependencies: | |
117 ! bar 1.0.0 | |
118 ! baz 0.0.1 from path $bazPath | |
119 ! foo 1.0.0 | |
120 """); | |
121 }); | |
122 }); | |
123 } | |
OLD | NEW |