Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: utils/tests/pub/pub_install_hosted_test.dart

Issue 11035066: Spit pub tests into smaller suites. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/tests/pub/pub_install_git_test.dart ('k') | utils/tests/pub/pub_install_sdk_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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('checks out a package from a pub server', () {
14 servePackages([package("foo", "1.2.3")]);
15
16 appDir([dependency("foo", "1.2.3")]).scheduleCreate();
17
18 schedulePub(args: ['install'],
19 output: const RegExp("Dependencies installed!\$"));
20
21 cacheDir({"foo": "1.2.3"}).scheduleValidate();
22 packagesDir({"foo": "1.2.3"}).scheduleValidate();
23
24 run();
25 });
26
27 test('fails gracefully if the url does not resolve', () {
28 dir(appPath, [
29 pubspec({
30 "name": "myapp",
31 "dependencies": {
32 "foo": {
33 "hosted": {
34 "name": "foo",
35 "url": "http://pub.invalid"
36 }
37 }
38 }
39 })
40 ]).scheduleCreate();
41
42 schedulePub(args: ['install'],
43 error: const RegExp('Could not resolve URL "http://pub.invalid".'),
44 exitCode: 1);
45
46 run();
47 });
48
49 test('fails gracefully if the package does not exist', () {
50 servePackages([]);
51
52 appDir([dependency("foo", "1.2.3")]).scheduleCreate();
53
54 schedulePub(args: ['install'],
55 error: const RegExp('Could not find package "foo" on '
56 'http://localhost:'),
57 exitCode: 1);
58
59 run();
60 });
61
62 test('checks out packages transitively from a pub server', () {
63 servePackages([
64 package("foo", "1.2.3", [dependency("bar", "2.0.4")]),
65 package("bar", "2.0.3"),
66 package("bar", "2.0.4"),
67 package("bar", "2.0.5")
68 ]);
69
70 appDir([dependency("foo", "1.2.3")]).scheduleCreate();
71
72 schedulePub(args: ['install'],
73 output: const RegExp("Dependencies installed!\$"));
74
75 cacheDir({"foo": "1.2.3", "bar": "2.0.4"}).scheduleValidate();
76 packagesDir({"foo": "1.2.3", "bar": "2.0.4"}).scheduleValidate();
77
78 run();
79 });
80
81 test('resolves version constraints from a pub server', () {
82 servePackages([
83 package("foo", "1.2.3", [dependency("baz", ">=2.0.0")]),
84 package("bar", "2.3.4", [dependency("baz", "<3.0.0")]),
85 package("baz", "2.0.3"),
86 package("baz", "2.0.4"),
87 package("baz", "3.0.1")
88 ]);
89
90 appDir([dependency("foo"), dependency("bar")]).scheduleCreate();
91
92 schedulePub(args: ['install'],
93 output: const RegExp("Dependencies installed!\$"));
94
95 cacheDir({
96 "foo": "1.2.3",
97 "bar": "2.3.4",
98 "baz": "2.0.4"
99 }).scheduleValidate();
100
101 packagesDir({
102 "foo": "1.2.3",
103 "bar": "2.3.4",
104 "baz": "2.0.4"
105 }).scheduleValidate();
106
107 run();
108 });
109
110 test('keeps a pub server package locked to the version in the lockfile', () {
111 servePackages([package("foo", "1.0.0")]);
112
113 appDir([dependency("foo")]).scheduleCreate();
114
115 // This install should lock the foo dependency to version 1.0.0.
116 schedulePub(args: ['install'],
117 output: const RegExp(r"Dependencies installed!$"));
118
119 packagesDir({"foo": "1.0.0"}).scheduleValidate();
120
121 // Delete the packages path to simulate a new checkout of the application.
122 dir(packagesPath).scheduleDelete();
123
124 // Start serving a newer package as well.
125 servePackages([package("foo", "1.0.1")]);
126
127 // This install shouldn't update the foo dependency due to the lockfile.
128 schedulePub(args: ['install'],
129 output: const RegExp(r"Dependencies installed!$"));
130
131 packagesDir({"foo": "1.0.0"}).scheduleValidate();
132
133 run();
134 });
135
136 test('updates a locked pub server package with a new incompatible '
137 'constraint', () {
138 servePackages([package("foo", "1.0.0")]);
139
140 appDir([dependency("foo")]).scheduleCreate();
141
142 schedulePub(args: ['install'],
143 output: const RegExp(r"Dependencies installed!$"));
144
145 packagesDir({"foo": "1.0.0"}).scheduleValidate();
146
147 servePackages([package("foo", "1.0.1")]);
148
149 appDir([dependency("foo", ">1.0.0")]).scheduleCreate();
150
151 schedulePub(args: ['install'],
152 output: const RegExp(r"Dependencies installed!$"));
153
154 packagesDir({"foo": "1.0.1"}).scheduleValidate();
155
156 run();
157 });
158
159 test("doesn't update a locked pub server package with a new compatible "
160 "constraint", () {
161 servePackages([package("foo", "1.0.0")]);
162
163 appDir([dependency("foo")]).scheduleCreate();
164
165 schedulePub(args: ['install'],
166 output: const RegExp(r"Dependencies installed!$"));
167
168 packagesDir({"foo": "1.0.0"}).scheduleValidate();
169
170 servePackages([package("foo", "1.0.1")]);
171
172 appDir([dependency("foo", ">=1.0.0")]).scheduleCreate();
173
174 schedulePub(args: ['install'],
175 output: const RegExp(r"Dependencies installed!$"));
176
177 packagesDir({"foo": "1.0.0"}).scheduleValidate();
178
179 run();
180 });
181
182 test("unlocks dependencies if necessary to ensure that a new dependency "
183 "is satisfied", () {
184 servePackages([
185 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]),
186 package("bar", "1.0.0", [dependency("baz", "<2.0.0")]),
187 package("baz", "1.0.0", [dependency("qux", "<2.0.0")]),
188 package("qux", "1.0.0")
189 ]);
190
191 appDir([dependency("foo")]).scheduleCreate();
192
193 schedulePub(args: ['install'],
194 output: const RegExp(r"Dependencies installed!$"));
195
196 packagesDir({
197 "foo": "1.0.0",
198 "bar": "1.0.0",
199 "baz": "1.0.0",
200 "qux": "1.0.0"
201 }).scheduleValidate();
202
203 servePackages([
204 package("foo", "2.0.0", [dependency("bar", "<3.0.0")]),
205 package("bar", "2.0.0", [dependency("baz", "<3.0.0")]),
206 package("baz", "2.0.0", [dependency("qux", "<3.0.0")]),
207 package("qux", "2.0.0"),
208 package("newdep", "2.0.0", [dependency("baz", ">=1.5.0")])
209 ]);
210
211 appDir([dependency("foo"), dependency("newdep")]).scheduleCreate();
212
213 schedulePub(args: ['install'],
214 output: const RegExp(r"Dependencies installed!$"));
215
216 packagesDir({
217 "foo": "2.0.0",
218 "bar": "2.0.0",
219 "baz": "2.0.0",
220 "qux": "1.0.0",
221 "newdep": "2.0.0"
222 }).scheduleValidate();
223
224 run();
225 });
226
227 test("doesn't unlock dependencies if a new dependency is already "
228 "satisfied", () {
229 servePackages([
230 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]),
231 package("bar", "1.0.0", [dependency("baz", "<2.0.0")]),
232 package("baz", "1.0.0")
233 ]);
234
235 appDir([dependency("foo")]).scheduleCreate();
236
237 schedulePub(args: ['install'],
238 output: const RegExp(r"Dependencies installed!$"));
239
240 packagesDir({
241 "foo": "1.0.0",
242 "bar": "1.0.0",
243 "baz": "1.0.0"
244 }).scheduleValidate();
245
246 servePackages([
247 package("foo", "2.0.0", [dependency("bar", "<3.0.0")]),
248 package("bar", "2.0.0", [dependency("baz", "<3.0.0")]),
249 package("baz", "2.0.0"),
250 package("newdep", "2.0.0", [dependency("baz", ">=1.0.0")])
251 ]);
252
253 appDir([dependency("foo"), dependency("newdep")]).scheduleCreate();
254
255 schedulePub(args: ['install'],
256 output: const RegExp(r"Dependencies installed!$"));
257
258 packagesDir({
259 "foo": "1.0.0",
260 "bar": "1.0.0",
261 "baz": "1.0.0",
262 "newdep": "2.0.0"
263 }).scheduleValidate();
264
265 run();
266 });
267
268 test("removes a dependency that's been removed from the pubspec", () {
269 servePackages([
270 package("foo", "1.0.0"),
271 package("bar", "1.0.0")
272 ]);
273
274 appDir([dependency("foo"), dependency("bar")]).scheduleCreate();
275
276 schedulePub(args: ['install'],
277 output: const RegExp(r"Dependencies installed!$"));
278
279 packagesDir({
280 "foo": "1.0.0",
281 "bar": "1.0.0"
282 }).scheduleValidate();
283
284 appDir([dependency("foo")]).scheduleCreate();
285
286 schedulePub(args: ['install'],
287 output: const RegExp(r"Dependencies installed!$"));
288
289 packagesDir({
290 "foo": "1.0.0",
291 "bar": null
292 }).scheduleValidate();
293
294 run();
295 });
296
297 test("removes a transitive dependency that's no longer depended on", () {
298 servePackages([
299 package("foo", "1.0.0", [dependency("shared-dep")]),
300 package("bar", "1.0.0", [
301 dependency("shared-dep"),
302 dependency("bar-dep")
303 ]),
304 package("shared-dep", "1.0.0"),
305 package("bar-dep", "1.0.0")
306 ]);
307
308 appDir([dependency("foo"), dependency("bar")]).scheduleCreate();
309
310 schedulePub(args: ['install'],
311 output: const RegExp(r"Dependencies installed!$"));
312
313 packagesDir({
314 "foo": "1.0.0",
315 "bar": "1.0.0",
316 "shared-dep": "1.0.0",
317 "bar-dep": "1.0.0",
318 }).scheduleValidate();
319
320 appDir([dependency("foo")]).scheduleCreate();
321
322 schedulePub(args: ['install'],
323 output: const RegExp(r"Dependencies installed!$"));
324
325 packagesDir({
326 "foo": "1.0.0",
327 "bar": null,
328 "shared-dep": "1.0.0",
329 "bar-dep": null,
330 }).scheduleValidate();
331
332 run();
333 });
334
335 test("doesn't update dependencies whose constraints have been removed", () {
336 servePackages([
337 package("foo", "1.0.0", [dependency("shared-dep")]),
338 package("bar", "1.0.0", [dependency("shared-dep", "<2.0.0")]),
339 package("shared-dep", "1.0.0"),
340 package("shared-dep", "2.0.0")
341 ]);
342
343 appDir([dependency("foo"), dependency("bar")]).scheduleCreate();
344
345 schedulePub(args: ['install'],
346 output: const RegExp(r"Dependencies installed!$"));
347
348 packagesDir({
349 "foo": "1.0.0",
350 "bar": "1.0.0",
351 "shared-dep": "1.0.0"
352 }).scheduleValidate();
353
354 appDir([dependency("foo")]).scheduleCreate();
355
356 schedulePub(args: ['install'],
357 output: const RegExp(r"Dependencies installed!$"));
358
359 packagesDir({
360 "foo": "1.0.0",
361 "bar": null,
362 "shared-dep": "1.0.0"
363 }).scheduleValidate();
364
365 run();
366 });
367 }
OLDNEW
« no previous file with comments | « utils/tests/pub/pub_install_git_test.dart ('k') | utils/tests/pub/pub_install_sdk_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698