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('test_pub.dart'); | |
10 #import('../../../pkg/unittest/unittest.dart'); | |
11 | |
12 main() { | |
13 test("updates one locked pub server package's dependencies if it's " | |
14 "necessary", () { | |
15 servePackages([ | |
16 package("foo", "1.0.0", [dependency("foo-dep")]), | |
17 package("foo-dep", "1.0.0") | |
18 ]); | |
19 | |
20 appDir([dependency("foo")]).scheduleCreate(); | |
21 | |
22 schedulePub(args: ['install'], | |
23 output: const RegExp(@"Dependencies installed!$")); | |
24 | |
25 packagesDir({ | |
26 "foo": "1.0.0", | |
27 "foo-dep": "1.0.0" | |
28 }).scheduleValidate(); | |
29 | |
30 servePackages([ | |
31 package("foo", "2.0.0", [dependency("foo-dep", ">1.0.0")]), | |
32 package("foo-dep", "2.0.0") | |
33 ]); | |
34 | |
35 schedulePub(args: ['update', 'foo'], | |
36 output: const RegExp(@"Dependencies updated!$")); | |
37 | |
38 packagesDir({ | |
39 "foo": "2.0.0", | |
40 "foo-dep": "2.0.0" | |
41 }).scheduleValidate(); | |
42 | |
43 run(); | |
44 }); | |
45 | |
46 test("updates a locked package's dependers in order to get it to max " | |
47 "version", () { | |
48 servePackages([ | |
49 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]), | |
50 package("bar", "1.0.0") | |
51 ]); | |
52 | |
53 appDir([dependency("foo"), dependency("bar")]).scheduleCreate(); | |
54 | |
55 schedulePub(args: ['install'], | |
56 output: const RegExp(@"Dependencies installed!$")); | |
57 | |
58 packagesDir({ | |
59 "foo": "1.0.0", | |
60 "bar": "1.0.0" | |
61 }).scheduleValidate(); | |
62 | |
63 servePackages([ | |
64 package("foo", "2.0.0", [dependency("bar", "<3.0.0")]), | |
65 package("bar", "2.0.0") | |
66 ]); | |
67 | |
68 schedulePub(args: ['update', 'bar'], | |
69 output: const RegExp(@"Dependencies updated!$")); | |
70 | |
71 packagesDir({ | |
72 "foo": "2.0.0", | |
73 "bar": "2.0.0" | |
74 }).scheduleValidate(); | |
75 | |
76 run(); | |
77 }); | |
78 | |
79 test("removes a dependency that's been removed from the pubspec", () { | |
80 servePackages([ | |
81 package("foo", "1.0.0"), | |
82 package("bar", "1.0.0") | |
83 ]); | |
84 | |
85 appDir([dependency("foo"), dependency("bar")]).scheduleCreate(); | |
86 | |
87 schedulePub(args: ['update'], | |
88 output: const RegExp(@"Dependencies updated!$")); | |
89 | |
90 packagesDir({ | |
91 "foo": "1.0.0", | |
92 "bar": "1.0.0" | |
93 }).scheduleValidate(); | |
94 | |
95 appDir([dependency("foo")]).scheduleCreate(); | |
96 | |
97 schedulePub(args: ['update'], | |
98 output: const RegExp(@"Dependencies updated!$")); | |
99 | |
100 packagesDir({ | |
101 "foo": "1.0.0", | |
102 "bar": null | |
103 }).scheduleValidate(); | |
104 | |
105 run(); | |
106 }); | |
107 | |
108 test("removes a transitive dependency that's no longer depended on", () { | |
109 servePackages([ | |
110 package("foo", "1.0.0", [dependency("shared-dep")]), | |
111 package("bar", "1.0.0", [ | |
112 dependency("shared-dep"), | |
113 dependency("bar-dep") | |
114 ]), | |
115 package("shared-dep", "1.0.0"), | |
116 package("bar-dep", "1.0.0") | |
117 ]); | |
118 | |
119 appDir([dependency("foo"), dependency("bar")]).scheduleCreate(); | |
120 | |
121 schedulePub(args: ['update'], | |
122 output: const RegExp(@"Dependencies updated!$")); | |
123 | |
124 packagesDir({ | |
125 "foo": "1.0.0", | |
126 "bar": "1.0.0", | |
127 "shared-dep": "1.0.0", | |
128 "bar-dep": "1.0.0", | |
129 }).scheduleValidate(); | |
130 | |
131 appDir([dependency("foo")]).scheduleCreate(); | |
132 | |
133 schedulePub(args: ['update'], | |
134 output: const RegExp(@"Dependencies updated!$")); | |
135 | |
136 packagesDir({ | |
137 "foo": "1.0.0", | |
138 "bar": null, | |
139 "shared-dep": "1.0.0", | |
140 "bar-dep": null, | |
141 }).scheduleValidate(); | |
142 | |
143 run(); | |
144 }); | |
145 | |
146 test("updates dependencies whose constraints have been removed", () { | |
147 servePackages([ | |
148 package("foo", "1.0.0", [dependency("shared-dep")]), | |
149 package("bar", "1.0.0", [dependency("shared-dep", "<2.0.0")]), | |
150 package("shared-dep", "1.0.0"), | |
151 package("shared-dep", "2.0.0") | |
152 ]); | |
153 | |
154 appDir([dependency("foo"), dependency("bar")]).scheduleCreate(); | |
155 | |
156 schedulePub(args: ['update'], | |
157 output: const RegExp(@"Dependencies updated!$")); | |
158 | |
159 packagesDir({ | |
160 "foo": "1.0.0", | |
161 "bar": "1.0.0", | |
162 "shared-dep": "1.0.0" | |
163 }).scheduleValidate(); | |
164 | |
165 appDir([dependency("foo")]).scheduleCreate(); | |
166 | |
167 schedulePub(args: ['update'], | |
168 output: const RegExp(@"Dependencies updated!$")); | |
169 | |
170 packagesDir({ | |
171 "foo": "1.0.0", | |
172 "bar": null, | |
173 "shared-dep": "2.0.0" | |
174 }).scheduleValidate(); | |
175 | |
176 run(); | |
177 }); | |
178 } | |
OLD | NEW |