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

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

Issue 10873051: Reverting 11261 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | « no previous file | utils/tests/pub/test_pub.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library('pub_tests'); 5 #library('pub_tests');
6 6
7 #import('dart:io'); 7 #import('dart:io');
8 8
9 #import('test_pub.dart'); 9 #import('test_pub.dart');
10 #import('../../../pkg/unittest/unittest.dart'); 10 #import('../../../pkg/unittest/unittest.dart');
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 '''); 86 ''');
87 }); 87 });
88 }); 88 });
89 */ 89 */
90 } 90 }
91 91
92 installCommand() { 92 installCommand() {
93 test('checks out a package from the SDK', () { 93 test('checks out a package from the SDK', () {
94 dir(sdkPath, [ 94 dir(sdkPath, [
95 file('revision', '1234'), 95 file('revision', '1234'),
96 dir('pkg', [packageDir("foo", "0.0.1234")]) 96 dir('pkg', [
97 dir('foo', [
98 file('foo.dart', 'main() => "foo";')
99 ])
100 ])
97 ]).scheduleCreate(); 101 ]).scheduleCreate();
98 102
99 dir(appPath, [ 103 dir(appPath, [
100 pubspec({"dependencies": {"foo": null}}) 104 file('pubspec.yaml', 'dependencies:\n foo:')
101 ]).scheduleCreate(); 105 ]).scheduleCreate();
102 106
103 schedulePub(args: ['install'], 107 schedulePub(args: ['install'],
104 output: ''' 108 output: '''
105 Dependencies installed! 109 Dependencies installed!
106 '''); 110 ''');
107 111
108 packagesDir({"foo": "0.0.1234"}).scheduleValidate(); 112 dir(packagesPath, [
113 dir('foo', [
114 file('foo.dart', 'main() => "foo";')
115 ])
116 ]).scheduleValidate();
109 117
110 run(); 118 run();
111 }); 119 });
112 120
113 test('checks out a package from Git', () { 121 test('checks out a package from Git', () {
114 ensureGit(); 122 ensureGit();
115 123
116 git('foo.git', [ 124 git('foo.git', [
117 file('foo.dart', 'main() => "foo";') 125 file('foo.dart', 'main() => "foo";')
118 ]).scheduleCreate(); 126 ]).scheduleCreate();
119 127
120 appDir([{"git": "../foo.git"}]).scheduleCreate(); 128 dir(appPath, [
129 file('pubspec.yaml', '''
130 dependencies:
131 foo:
132 git: ../foo.git
133 ''')
134 ]).scheduleCreate();
121 135
122 schedulePub(args: ['install'], 136 schedulePub(args: ['install'],
123 output: const RegExp(@"Dependencies installed!$")); 137 output: const RegExp(@"Dependencies installed!$"));
124 138
125 dir(cachePath, [ 139 dir(cachePath, [
126 dir('git', [ 140 dir('git', [
127 dir('cache', [gitPackageCacheDir('foo')]), 141 dir('cache', [
128 gitPackageCacheDir('foo') 142 dir(new RegExp(@'foo-[a-f0-9]+'), [
143 file('foo.dart', 'main() => "foo";')
144 ])
145 ]),
146 dir(new RegExp(@'foo-[a-f0-9]+'), [
147 file('foo.dart', 'main() => "foo";')
148 ])
129 ]) 149 ])
130 ]).scheduleValidate(); 150 ]).scheduleValidate();
131 151
132 dir(packagesPath, [ 152 dir(packagesPath, [
133 dir('foo', [ 153 dir('foo', [
134 file('foo.dart', 'main() => "foo";') 154 file('foo.dart', 'main() => "foo";')
135 ]) 155 ])
136 ]).scheduleValidate(); 156 ]).scheduleValidate();
137 157
138 run(); 158 run();
139 }); 159 });
140 160
141 test('checks out packages transitively from Git', () { 161 test('checks out packages transitively from Git', () {
142 ensureGit(); 162 ensureGit();
143 163
144 git('foo.git', [ 164 git('foo.git', [
145 file('foo.dart', 'main() => "foo";'), 165 file('foo.dart', 'main() => "foo";'),
146 appPubspec([{"git": "../bar.git"}]) 166 file('pubspec.yaml', '''
167 dependencies:
168 bar:
169 git: ../bar.git
170 ''')
147 ]).scheduleCreate(); 171 ]).scheduleCreate();
148 172
149 git('bar.git', [ 173 git('bar.git', [
150 file('bar.dart', 'main() => "bar";') 174 file('bar.dart', 'main() => "bar";')
151 ]).scheduleCreate(); 175 ]).scheduleCreate();
152 176
153 appDir([{"git": "../foo.git"}]).scheduleCreate(); 177 dir(appPath, [
178 file('pubspec.yaml', '''
179 dependencies:
180 foo:
181 git: ../foo.git
182 ''')
183 ]).scheduleCreate();
154 184
155 schedulePub(args: ['install'], 185 schedulePub(args: ['install'],
156 output: const RegExp("Dependencies installed!\$")); 186 output: const RegExp("Dependencies installed!\$"));
157 187
158 dir(cachePath, [ 188 dir(cachePath, [
159 dir('git', [ 189 dir('git', [
160 dir('cache', [ 190 dir('cache', [
161 gitPackageCacheDir('foo'), 191 dir(new RegExp(@'foo-[a-f0-9]+'), [
162 gitPackageCacheDir('bar') 192 file('foo.dart', 'main() => "foo";')
193 ]),
194 dir(new RegExp(@'bar-[a-f0-9]+'), [
195 file('bar.dart', 'main() => "bar";')
196 ])
163 ]), 197 ]),
164 gitPackageCacheDir('foo'), 198 dir(new RegExp(@'foo-[a-f0-9]+'), [
165 gitPackageCacheDir('bar') 199 file('foo.dart', 'main() => "foo";')
200 ]),
201 dir(new RegExp(@'bar-[a-f0-9]+'), [
202 file('bar.dart', 'main() => "bar";')
203 ])
166 ]) 204 ])
167 ]).scheduleValidate(); 205 ]).scheduleValidate();
168 206
169 dir(packagesPath, [ 207 dir(packagesPath, [
170 dir('foo', [ 208 dir('foo', [
171 file('foo.dart', 'main() => "foo";') 209 file('foo.dart', 'main() => "foo";')
172 ]), 210 ]),
173 dir('bar', [ 211 dir('bar', [
174 file('bar.dart', 'main() => "bar";') 212 file('bar.dart', 'main() => "bar";')
175 ]) 213 ])
176 ]).scheduleValidate(); 214 ]).scheduleValidate();
177 215
178 run(); 216 run();
179 }); 217 });
180 218
181 test('checks out and updates a package from Git', () { 219 test('checks out and updates a package from Git', () {
182 ensureGit(); 220 ensureGit();
183 221
184 git('foo.git', [ 222 git('foo.git', [
185 file('foo.dart', 'main() => "foo";') 223 file('foo.dart', 'main() => "foo";')
186 ]).scheduleCreate(); 224 ]).scheduleCreate();
187 225
188 appDir([{"git": "../foo.git"}]).scheduleCreate(); 226 dir(appPath, [
227 file('pubspec.yaml', '''
228 dependencies:
229 foo:
230 git: ../foo.git
231 ''')
232 ]).scheduleCreate();
189 233
190 schedulePub(args: ['install'], 234 schedulePub(args: ['install'],
191 output: const RegExp(@"Dependencies installed!$")); 235 output: const RegExp(@"Dependencies installed!$"));
192 236
193 dir(cachePath, [ 237 dir(cachePath, [
194 dir('git', [ 238 dir('git', [
195 dir('cache', [gitPackageCacheDir('foo')]), 239 dir('cache', [
196 gitPackageCacheDir('foo') 240 dir(new RegExp(@'foo-[a-f0-9]+'), [
241 file('foo.dart', 'main() => "foo";')
242 ])
243 ]),
244 dir(new RegExp(@'foo-[a-f0-9]+'), [
245 file('foo.dart', 'main() => "foo";')
246 ])
197 ]) 247 ])
198 ]).scheduleValidate(); 248 ]).scheduleValidate();
199 249
200 dir(packagesPath, [ 250 dir(packagesPath, [
201 dir('foo', [ 251 dir('foo', [
202 file('foo.dart', 'main() => "foo";') 252 file('foo.dart', 'main() => "foo";')
203 ]) 253 ])
204 ]).scheduleValidate(); 254 ]).scheduleValidate();
205 255
206 // TODO(nweiz): remove this once we support pub update 256 // TODO(nweiz): remove this once we support pub update
207 dir(packagesPath).scheduleDelete(); 257 dir(packagesPath).scheduleDelete();
208 file('$appPath/pubspec.lock', '').scheduleDelete(); 258 file('$appPath/pubspec.lock', '').scheduleDelete();
209 259
210 git('foo.git', [ 260 git('foo.git', [
211 file('foo.dart', 'main() => "foo 2";') 261 file('foo.dart', 'main() => "foo 2";')
212 ]).scheduleCommit(); 262 ]).scheduleCommit();
213 263
214 schedulePub(args: ['install'], 264 schedulePub(args: ['install'],
215 output: const RegExp(@"Dependencies installed!$")); 265 output: const RegExp(@"Dependencies installed!$"));
216 266
217 // When we download a new version of the git package, we should re-use the 267 // When we download a new version of the git package, we should re-use the
218 // git/cache directory but create a new git/ directory. 268 // git/cache directory but create a new git/ directory.
219 dir(cachePath, [ 269 dir(cachePath, [
220 dir('git', [ 270 dir('git', [
221 dir('cache', [gitPackageCacheDir('foo', 2)]), 271 dir('cache', [
222 gitPackageCacheDir('foo'), 272 dir(new RegExp(@'foo-[a-f0-9]+'), [
223 gitPackageCacheDir('foo', 2) 273 file('foo.dart', 'main() => "foo 2";')
274 ])
275 ]),
276 dir(new RegExp(@'foo-[a-f0-9]+'), [
277 file('foo.dart', 'main() => "foo";')
278 ]),
279 dir(new RegExp(@'foo-[a-f0-9]+'), [
280 file('foo.dart', 'main() => "foo 2";')
281 ])
224 ]) 282 ])
225 ]).scheduleValidate(); 283 ]).scheduleValidate();
226 284
227 dir(packagesPath, [ 285 dir(packagesPath, [
228 dir('foo', [ 286 dir('foo', [
229 file('foo.dart', 'main() => "foo 2";') 287 file('foo.dart', 'main() => "foo 2";')
230 ]) 288 ])
231 ]).scheduleValidate(); 289 ]).scheduleValidate();
232 290
233 run(); 291 run();
234 }); 292 });
235 293
236 test('checks out a package from Git twice', () { 294 test('checks out a package from Git twice', () {
237 ensureGit(); 295 ensureGit();
238 296
239 git('foo.git', [ 297 git('foo.git', [
240 file('foo.dart', 'main() => "foo";') 298 file('foo.dart', 'main() => "foo";')
241 ]).scheduleCreate(); 299 ]).scheduleCreate();
242 300
243 appDir([{"git": "../foo.git"}]).scheduleCreate(); 301 dir(appPath, [
302 file('pubspec.yaml', '''
303 dependencies:
304 foo:
305 git: ../foo.git
306 ''')
307 ]).scheduleCreate();
244 308
245 schedulePub(args: ['install'], 309 schedulePub(args: ['install'],
246 output: const RegExp(@"Dependencies installed!$")); 310 output: const RegExp(@"Dependencies installed!$"));
247 311
248 dir(cachePath, [ 312 dir(cachePath, [
249 dir('git', [ 313 dir('git', [
250 dir('cache', [gitPackageCacheDir('foo')]), 314 dir('cache', [
251 gitPackageCacheDir('foo') 315 dir(new RegExp(@'foo-[a-f0-9]+'), [
316 file('foo.dart', 'main() => "foo";')
317 ])
318 ]),
319 dir(new RegExp(@'foo-[a-f0-9]+'), [
320 file('foo.dart', 'main() => "foo";')
321 ])
252 ]) 322 ])
253 ]).scheduleValidate(); 323 ]).scheduleValidate();
254 324
255 dir(packagesPath, [ 325 dir(packagesPath, [
256 dir('foo', [ 326 dir('foo', [
257 file('foo.dart', 'main() => "foo";') 327 file('foo.dart', 'main() => "foo";')
258 ]) 328 ])
259 ]).scheduleValidate(); 329 ]).scheduleValidate();
260 330
261 // TODO(nweiz): remove this once we support pub update 331 // TODO(nweiz): remove this once we support pub update
262 dir(packagesPath).scheduleDelete(); 332 dir(packagesPath).scheduleDelete();
263 333
264 // Verify that nothing breaks if we install a Git revision that's already 334 // Verify that nothing breaks if we install a Git revision that's already
265 // in the cache. 335 // in the cache.
266 schedulePub(args: ['install'], 336 schedulePub(args: ['install'],
267 output: const RegExp(@"Dependencies installed!$")); 337 output: const RegExp(@"Dependencies installed!$"));
268 338
269 run(); 339 run();
270 }); 340 });
271 341
272 test('checks out a package at a specific revision from Git', () { 342 test('checks out a package at a specific revision from Git', () {
273 ensureGit(); 343 ensureGit();
274 344
275 var repo = git('foo.git', [ 345 var repo = git('foo.git', [
276 file('foo.dart', 'main() => "foo 1";') 346 file('foo.dart', 'main() => "foo 1";')
277 ]); 347 ]);
278 repo.scheduleCreate(); 348 repo.scheduleCreate();
279 var commit = repo.revParse('HEAD'); 349 var commitFuture = repo.revParse('HEAD');
280 350
281 git('foo.git', [ 351 git('foo.git', [
282 file('foo.dart', 'main() => "foo 2";') 352 file('foo.dart', 'main() => "foo 2";')
283 ]).scheduleCommit(); 353 ]).scheduleCommit();
284 354
285 appDir([{"git": {"url": "../foo.git", "ref": commit}}]).scheduleCreate(); 355 dir(appPath, [
356 async(commitFuture.transform((commit) {
357 return file('pubspec.yaml', '''
358 dependencies:
359 foo:
360 git:
361 url: ../foo.git
362 ref: $commit
363 ''');
364 }))
365 ]).scheduleCreate();
286 366
287 schedulePub(args: ['install'], 367 schedulePub(args: ['install'],
288 output: const RegExp(@"Dependencies installed!$")); 368 output: const RegExp(@"Dependencies installed!$"));
289 369
290 dir(packagesPath, [ 370 dir(packagesPath, [
291 dir('foo', [ 371 dir('foo', [
292 file('foo.dart', 'main() => "foo 1";') 372 file('foo.dart', 'main() => "foo 1";')
293 ]) 373 ])
294 ]).scheduleValidate(); 374 ]).scheduleValidate();
295 375
296 run(); 376 run();
297 }); 377 });
298 378
299 test('checks out a package from a pub server', () { 379 test('checks out a package from a pub server', () {
300 servePackages("localhost", 3123, [package("foo", "1.2.3")]); 380 servePackages("localhost", 3123, ['{name: foo, version: 1.2.3}']);
301 381
302 appDir([dependency("foo", "1.2.3")]).scheduleCreate(); 382 dir(appPath, [
383 file('pubspec.yaml', '''
384 dependencies:
385 foo:
386 repo:
387 name: foo
388 url: http://localhost:3123
389 version: 1.2.3
390 ''')
391 ]).scheduleCreate();
303 392
304 schedulePub(args: ['install'], 393 schedulePub(args: ['install'],
305 output: const RegExp("Dependencies installed!\$")); 394 output: const RegExp("Dependencies installed!\$"));
306 395
307 cacheDir({"foo": "1.2.3"}).scheduleValidate(); 396 dir(cachePath, [
308 packagesDir({"foo": "1.2.3"}).scheduleValidate(); 397 dir('repo', [
398 dir('localhost%583123', [
399 dir('foo-1.2.3', [
400 file('pubspec.yaml', '{name: foo, version: 1.2.3}'),
401 file('foo.dart', 'main() => print("foo 1.2.3");')
402 ])
403 ])
404 ])
405 ]).scheduleValidate();
406
407 dir(packagesPath, [
408 dir('foo', [
409 file('pubspec.yaml', '{name: foo, version: 1.2.3}'),
410 file('foo.dart', 'main() => print("foo 1.2.3");')
411 ])
412 ]).scheduleValidate();
309 413
310 run(); 414 run();
311 }); 415 });
312 416
313 test('checks out packages transitively from a pub server', () { 417 test('checks out packages transitively from a pub server', () {
314 servePackages("localhost", 3123, [ 418 servePackages("localhost", 3123, [
315 package("foo", "1.2.3", [dependency("bar", "2.0.4")]), 419 '''
316 package("bar", "2.0.3"), 420 name: foo
317 package("bar", "2.0.4"), 421 version: 1.2.3
318 package("bar", "2.0.5") 422 dependencies:
423 bar:
424 repo: {name: bar, url: http://localhost:3123}
425 version: 2.0.4
426 ''',
427 '{name: bar, version: 2.0.3}',
428 '{name: bar, version: 2.0.4}',
429 '{name: bar, version: 2.0.5}',
319 ]); 430 ]);
320 431
321 appDir([dependency("foo", "1.2.3")]).scheduleCreate(); 432 dir(appPath, [
433 file('pubspec.yaml', '''
434 dependencies:
435 foo:
436 repo:
437 name: foo
438 url: http://localhost:3123
439 version: 1.2.3
440 ''')
441 ]).scheduleCreate();
322 442
323 schedulePub(args: ['install'], 443 schedulePub(args: ['install'],
324 output: const RegExp("Dependencies installed!\$")); 444 output: const RegExp("Dependencies installed!\$"));
325 445
326 cacheDir({"foo": "1.2.3", "bar": "2.0.4"}).scheduleValidate(); 446 dir(cachePath, [
327 packagesDir({"foo": "1.2.3", "bar": "2.0.4"}).scheduleValidate(); 447 dir('repo', [
448 dir('localhost%583123', [
449 dir('foo-1.2.3', [
450 file('pubspec.yaml', '''
451 name: foo
452 version: 1.2.3
453 dependencies:
454 bar:
455 repo: {name: bar, url: http://localhost:3123}
456 version: 2.0.4
457 '''),
458 file('foo.dart', 'main() => print("foo 1.2.3");')
459 ]),
460 dir('bar-2.0.4', [
461 file('pubspec.yaml', '{name: bar, version: 2.0.4}'),
462 file('bar.dart', 'main() => print("bar 2.0.4");')
463 ])
464 ])
465 ])
466 ]).scheduleValidate();
467
468 dir(packagesPath, [
469 dir('foo', [
470 file('pubspec.yaml', '''
471 name: foo
472 version: 1.2.3
473 dependencies:
474 bar:
475 repo: {name: bar, url: http://localhost:3123}
476 version: 2.0.4
477 '''),
478 file('foo.dart', 'main() => print("foo 1.2.3");')
479 ]),
480 dir('bar', [
481 file('pubspec.yaml', '{name: bar, version: 2.0.4}'),
482 file('bar.dart', 'main() => print("bar 2.0.4");')
483 ])
484 ]).scheduleValidate();
328 485
329 run(); 486 run();
330 }); 487 });
331 488
332 test('resolves version constraints from a pub server', () { 489 test('resolves version constraints from a pub server', () {
333 servePackages("localhost", 3123, [ 490 servePackages("localhost", 3123, [
334 package("foo", "1.2.3", [dependency("baz", ">=2.0.0")]), 491 '''
335 package("bar", "2.3.4", [dependency("baz", "<3.0.0")]), 492 name: foo
336 package("baz", "2.0.3"), 493 version: 1.2.3
337 package("baz", "2.0.4"), 494 dependencies:
338 package("baz", "3.0.1") 495 baz:
496 repo: {name: baz, url: http://localhost:3123}
497 version: ">=2.0.0"
498 ''',
499 '''
500 name: bar
501 version: 2.3.4
502 dependencies:
503 baz:
504 repo: {name: baz, url: http://localhost:3123}
505 version: "<3.0.0"
506 ''',
507 '{name: baz, version: 2.0.3}',
508 '{name: baz, version: 2.0.4}',
509 '{name: baz, version: 3.0.1}',
339 ]); 510 ]);
340 511
341 appDir([dependency("foo"), dependency("bar")]).scheduleCreate(); 512 dir(appPath, [
513 file('pubspec.yaml', '''
514 dependencies:
515 foo: {repo: {name: foo, url: http://localhost:3123}}
516 bar: {repo: {name: bar, url: http://localhost:3123}}
517 ''')
518 ]).scheduleCreate();
342 519
343 schedulePub(args: ['install'], 520 schedulePub(args: ['install'],
344 output: const RegExp("Dependencies installed!\$")); 521 output: const RegExp("Dependencies installed!\$"));
345 522
346 cacheDir({ 523 dir(cachePath, [
347 "foo": "1.2.3", 524 dir('repo', [
348 "bar": "2.3.4", 525 dir('localhost%583123', [
349 "baz": "2.0.4" 526 dir('foo-1.2.3', [
350 }).scheduleValidate(); 527 file('pubspec.yaml', '''
351 528 name: foo
352 packagesDir({ 529 version: 1.2.3
353 "foo": "1.2.3", 530 dependencies:
354 "bar": "2.3.4", 531 baz:
355 "baz": "2.0.4" 532 repo: {name: baz, url: http://localhost:3123}
356 }).scheduleValidate(); 533 version: ">=2.0.0"
534 '''),
535 file('foo.dart', 'main() => print("foo 1.2.3");')
536 ]),
537 dir('bar-2.3.4', [
538 file('pubspec.yaml', '''
539 name: bar
540 version: 2.3.4
541 dependencies:
542 baz:
543 repo: {name: baz, url: http://localhost:3123}
544 version: "<3.0.0"
545 '''),
546 file('bar.dart', 'main() => print("bar 2.3.4");')
547 ]),
548 dir('baz-2.0.4', [
549 file('pubspec.yaml', '{name: baz, version: 2.0.4}'),
550 file('baz.dart', 'main() => print("baz 2.0.4");')
551 ])
552 ])
553 ])
554 ]).scheduleValidate();
555
556 dir(packagesPath, [
557 dir('foo', [
558 file('pubspec.yaml', '''
559 name: foo
560 version: 1.2.3
561 dependencies:
562 baz:
563 repo: {name: baz, url: http://localhost:3123}
564 version: ">=2.0.0"
565 '''),
566 file('foo.dart', 'main() => print("foo 1.2.3");')
567 ]),
568 dir('bar', [
569 file('pubspec.yaml', '''
570 name: bar
571 version: 2.3.4
572 dependencies:
573 baz:
574 repo: {name: baz, url: http://localhost:3123}
575 version: "<3.0.0"
576 '''),
577 file('bar.dart', 'main() => print("bar 2.3.4");')
578 ]),
579 dir('baz', [
580 file('pubspec.yaml', '{name: baz, version: 2.0.4}'),
581 file('baz.dart', 'main() => print("baz 2.0.4");')
582 ])
583 ]).scheduleValidate();
357 584
358 run(); 585 run();
359 }); 586 });
360 587
361 test('keeps a Git package locked to the version in the lockfile', () { 588 test('keeps a Git package locked to the version in the lockfile', () {
362 ensureGit(); 589 ensureGit();
363 590
364 git('foo.git', [ 591 git('foo.git', [
365 file('foo.dart', 'main() => "foo";') 592 file('foo.dart', 'main() => "foo";')
366 ]).scheduleCreate(); 593 ]).scheduleCreate();
367 594
368 appDir([{"git": "../foo.git"}]).scheduleCreate(); 595 dir(appPath, [
596 file('pubspec.yaml', '''
597 dependencies:
598 foo:
599 git: ../foo.git
600 ''')
601 ]).scheduleCreate();
369 602
370 // This install should lock the foo.git dependency to the current revision. 603 // This install should lock the foo.git dependency to the current revision.
371 schedulePub(args: ['install'], 604 schedulePub(args: ['install'],
372 output: const RegExp(@"Dependencies installed!$")); 605 output: const RegExp(@"Dependencies installed!$"));
373 606
374 dir(packagesPath, [ 607 dir(packagesPath, [
375 dir('foo', [ 608 dir('foo', [
376 file('foo.dart', 'main() => "foo";') 609 file('foo.dart', 'main() => "foo";')
377 ]) 610 ])
378 ]).scheduleValidate(); 611 ]).scheduleValidate();
(...skipping 18 matching lines...) Expand all
397 run(); 630 run();
398 }); 631 });
399 632
400 test('updates a locked Git package with a new incompatible constraint', () { 633 test('updates a locked Git package with a new incompatible constraint', () {
401 ensureGit(); 634 ensureGit();
402 635
403 git('foo.git', [ 636 git('foo.git', [
404 file('foo.dart', 'main() => "foo";') 637 file('foo.dart', 'main() => "foo";')
405 ]).scheduleCreate(); 638 ]).scheduleCreate();
406 639
407 appDir([{"git": "../foo.git"}]).scheduleCreate(); 640 dir(appPath, [
641 file('pubspec.yaml', '''
642 dependencies:
643 foo:
644 git: ../foo.git
645 ''')
646 ]).scheduleCreate();
408 647
409 schedulePub(args: ['install'], 648 schedulePub(args: ['install'],
410 output: const RegExp(@"Dependencies installed!$")); 649 output: const RegExp(@"Dependencies installed!$"));
411 650
412 dir(packagesPath, [ 651 dir(packagesPath, [
413 dir('foo', [ 652 dir('foo', [
414 file('foo.dart', 'main() => "foo";') 653 file('foo.dart', 'main() => "foo";')
415 ]) 654 ])
416 ]).scheduleValidate(); 655 ]).scheduleValidate();
417 656
418 git('foo.git', [ 657 git('foo.git', [
419 file('foo.dart', 'main() => "foo 1.0.0";'), 658 file('foo.dart', 'main() => "foo 1.0.0";'),
420 libPubspec("foo", "1.0.0") 659 file('pubspec.yaml', 'version: 1.0.0')
421 ]).scheduleCommit(); 660 ]).scheduleCommit();
422 661
423 appDir([{"git": "../foo.git", "version": ">=1.0.0"}]).scheduleCreate(); 662 dir(appPath, [
663 file('pubspec.yaml', '''
664 dependencies:
665 foo:
666 git: ../foo.git
667 version: ">=1.0.0"
668 ''')
669 ]).scheduleCreate();
424 670
425 schedulePub(args: ['install'], 671 schedulePub(args: ['install'],
426 output: const RegExp(@"Dependencies installed!$")); 672 output: const RegExp(@"Dependencies installed!$"));
427 673
428 dir(packagesPath, [ 674 dir(packagesPath, [
429 dir('foo', [ 675 dir('foo', [
430 file('foo.dart', 'main() => "foo 1.0.0";') 676 file('foo.dart', 'main() => "foo 1.0.0";')
431 ]) 677 ])
432 ]).scheduleValidate(); 678 ]).scheduleValidate();
433 679
434 run(); 680 run();
435 }); 681 });
436 682
437 test("doesn't update a locked Git package with a new compatible " 683 test("doesn't update a locked Git package with a new compatible "
438 "constraint", () { 684 "constraint", () {
439 ensureGit(); 685 ensureGit();
440 686
441 git('foo.git', [ 687 git('foo.git', [
442 file('foo.dart', 'main() => "foo 1.0.0";'), 688 file('foo.dart', 'main() => "foo 1.0.0";'),
443 libPubspec("foo", "1.0.0") 689 file('pubspec.yaml', 'version: 1.0.0')
444 ]).scheduleCreate(); 690 ]).scheduleCreate();
445 691
446 appDir([{"git": "../foo.git"}]).scheduleCreate(); 692 dir(appPath, [
693 file('pubspec.yaml', '''
694 dependencies:
695 foo:
696 git: ../foo.git
697 ''')
698 ]).scheduleCreate();
447 699
448 schedulePub(args: ['install'], 700 schedulePub(args: ['install'],
449 output: const RegExp(@"Dependencies installed!$")); 701 output: const RegExp(@"Dependencies installed!$"));
450 702
451 dir(packagesPath, [ 703 dir(packagesPath, [
452 dir('foo', [ 704 dir('foo', [
453 file('foo.dart', 'main() => "foo 1.0.0";') 705 file('foo.dart', 'main() => "foo 1.0.0";')
454 ]) 706 ])
455 ]).scheduleValidate(); 707 ]).scheduleValidate();
456 708
457 git('foo.git', [ 709 git('foo.git', [
458 file('foo.dart', 'main() => "foo 1.0.1";'), 710 file('foo.dart', 'main() => "foo 1.0.1";'),
459 libPubspec("foo", "1.0.1") 711 file('pubspec.yaml', 'version: 1.0.1')
460 ]).scheduleCommit(); 712 ]).scheduleCommit();
461 713
462 appDir([{"git": "../foo.git", "version": ">=1.0.0"}]).scheduleCreate(); 714 dir(appPath, [
715 file('pubspec.yaml', '''
716 dependencies:
717 foo:
718 git: ../foo.git
719 version: ">=1.0.0"
720 ''')
721 ]).scheduleCreate();
463 722
464 schedulePub(args: ['install'], 723 schedulePub(args: ['install'],
465 output: const RegExp(@"Dependencies installed!$")); 724 output: const RegExp(@"Dependencies installed!$"));
466 725
467 dir(packagesPath, [ 726 dir(packagesPath, [
468 dir('foo', [ 727 dir('foo', [
469 file('foo.dart', 'main() => "foo 1.0.0";') 728 file('foo.dart', 'main() => "foo 1.0.0";')
470 ]) 729 ])
471 ]).scheduleValidate(); 730 ]).scheduleValidate();
472 731
473 run(); 732 run();
474 }); 733 });
475 734
476 test('keeps a pub server package locked to the version in the lockfile', () { 735 test('keeps a pub server package locked to the version in the lockfile', () {
477 servePackages("localhost", 3123, [package("foo", "1.0.0")]); 736 servePackages("localhost", 3123, ['{name: foo, version: 1.0.0}']);
478 737
479 appDir([dependency("foo")]).scheduleCreate(); 738 dir(appPath, [
739 file('pubspec.yaml', '''
740 dependencies:
741 foo:
742 repo: {name: foo, url: http://localhost:3123}
743 ''')
744 ]).scheduleCreate();
480 745
481 // This install should lock the foo dependency to version 1.0.0. 746 // This install should lock the foo dependency to version 1.0.0.
482 schedulePub(args: ['install'], 747 schedulePub(args: ['install'],
483 output: const RegExp(@"Dependencies installed!$")); 748 output: const RegExp(@"Dependencies installed!$"));
484 749
485 packagesDir({"foo": "1.0.0"}).scheduleValidate(); 750 dir(packagesPath, [
751 dir('foo', [
752 file('foo.dart', 'main() => print("foo 1.0.0");')
753 ])
754 ]).scheduleValidate();
486 755
487 // Delete the packages path to simulate a new checkout of the application. 756 // Delete the packages path to simulate a new checkout of the application.
488 dir(packagesPath).scheduleDelete(); 757 dir(packagesPath).scheduleDelete();
489 758
490 // Start serving a newer package as well. 759 // Start serving a newer package as well.
491 servePackages("localhost", 3123, [ 760 servePackages("localhost", 3123, [
492 package("foo", "1.0.0"), 761 '{name: foo, version: 1.0.0}',
493 package("foo", "1.0.1") 762 '{name: foo, version: 1.0.1}'
494 ]); 763 ]);
495 764
496 // This install shouldn't update the foo dependency due to the lockfile. 765 // This install shouldn't update the foo dependency due to the lockfile.
497 schedulePub(args: ['install'], 766 schedulePub(args: ['install'],
498 output: const RegExp(@"Dependencies installed!$")); 767 output: const RegExp(@"Dependencies installed!$"));
499 768
500 packagesDir({"foo": "1.0.0"}).scheduleValidate(); 769 dir(packagesPath, [
770 dir('foo', [
771 file('foo.dart', 'main() => print("foo 1.0.0");')
772 ])
773 ]).scheduleValidate();
501 774
502 run(); 775 run();
503 }); 776 });
504 777
505 test('updates a locked pub server package with a new incompatible ' 778 test('updates a locked pub server package with a new incompatible '
506 'constraint', () { 779 'constraint', () {
507 servePackages("localhost", 3123, [package("foo", "1.0.0")]); 780 servePackages("localhost", 3123, ['{name: foo, version: 1.0.0}']);
508 781
509 appDir([dependency("foo")]).scheduleCreate(); 782 dir(appPath, [
783 file('pubspec.yaml', '''
784 dependencies:
785 foo:
786 repo: {name: foo, url: http://localhost:3123}
787 ''')
788 ]).scheduleCreate();
510 789
511 schedulePub(args: ['install'], 790 schedulePub(args: ['install'],
512 output: const RegExp(@"Dependencies installed!$")); 791 output: const RegExp(@"Dependencies installed!$"));
513 792
514 packagesDir({"foo": "1.0.0"}).scheduleValidate(); 793 dir(packagesPath, [
794 dir('foo', [
795 file('foo.dart', 'main() => print("foo 1.0.0");')
796 ])
797 ]).scheduleValidate();
515 798
516 servePackages("localhost", 3123, [ 799 servePackages("localhost", 3123, [
517 package("foo", "1.0.0"), 800 '{name: foo, version: 1.0.0}',
518 package("foo", "1.0.1") 801 '{name: foo, version: 1.0.1}'
519 ]); 802 ]);
520 803
521 appDir([dependency("foo", ">1.0.0")]).scheduleCreate(); 804 dir(appPath, [
805 file('pubspec.yaml', '''
806 dependencies:
807 foo:
808 repo: {name: foo, url: http://localhost:3123}
809 version: ">1.0.0"
810 ''')
811 ]).scheduleCreate();
522 812
523 schedulePub(args: ['install'], 813 schedulePub(args: ['install'],
524 output: const RegExp(@"Dependencies installed!$")); 814 output: const RegExp(@"Dependencies installed!$"));
525 815
526 packagesDir({"foo": "1.0.1"}).scheduleValidate(); 816 dir(packagesPath, [
817 dir('foo', [
818 file('foo.dart', 'main() => print("foo 1.0.1");')
819 ])
820 ]).scheduleValidate();
527 821
528 run(); 822 run();
529 }); 823 });
530 824
531 test("doesn't update a locked pub server package with a new compatible " 825 test("doesn't update a locked pub server package with a new compatible "
532 "constraint", () { 826 "constraint", () {
533 servePackages("localhost", 3123, [package("foo", "1.0.0")]); 827 servePackages("localhost", 3123, ['{name: foo, version: 1.0.0}']);
534 828
535 appDir([dependency("foo")]).scheduleCreate(); 829 dir(appPath, [
830 file('pubspec.yaml', '''
831 dependencies:
832 foo:
833 repo: {name: foo, url: http://localhost:3123}
834 ''')
835 ]).scheduleCreate();
536 836
537 schedulePub(args: ['install'], 837 schedulePub(args: ['install'],
538 output: const RegExp(@"Dependencies installed!$")); 838 output: const RegExp(@"Dependencies installed!$"));
539 839
540 packagesDir({"foo": "1.0.0"}).scheduleValidate(); 840 dir(packagesPath, [
841 dir('foo', [
842 file('foo.dart', 'main() => print("foo 1.0.0");')
843 ])
844 ]).scheduleValidate();
541 845
542 servePackages("localhost", 3123, [ 846 servePackages("localhost", 3123, [
543 package("foo", "1.0.0"), 847 '{name: foo, version: 1.0.0}',
544 package("foo", "1.0.1") 848 '{name: foo, version: 1.0.1}'
545 ]); 849 ]);
546 850
547 appDir([dependency("foo", ">=1.0.0")]).scheduleCreate(); 851 dir(appPath, [
852 file('pubspec.yaml', '''
853 dependencies:
854 foo:
855 repo: {name: foo, url: http://localhost:3123}
856 version: ">=1.0.0"
857 ''')
858 ]).scheduleCreate();
548 859
549 schedulePub(args: ['install'], 860 schedulePub(args: ['install'],
550 output: const RegExp(@"Dependencies installed!$")); 861 output: const RegExp(@"Dependencies installed!$"));
551 862
552 packagesDir({"foo": "1.0.0"}).scheduleValidate(); 863 dir(packagesPath, [
864 dir('foo', [
865 file('foo.dart', 'main() => print("foo 1.0.0");')
866 ])
867 ]).scheduleValidate();
553 868
554 run(); 869 run();
555 }); 870 });
556 871
557 test("unlocks dependencies if necessary to ensure that a new dependency " 872 test("unlocks dependencies if necessary to ensure that a new dependency "
558 "is satisfied", () { 873 "is satisfied", () {
559 servePackages("localhost", 3123, [ 874 servePackages("localhost", 3123, [
560 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]), 875 '''
561 package("bar", "1.0.0", [dependency("baz", "<2.0.0")]), 876 name: foo
562 package("baz", "1.0.0", [dependency("qux", "<2.0.0")]), 877 version: 1.0.0
563 package("qux", "1.0.0") 878 dependencies:
564 ]); 879 bar:
880 version: "<2.0.0"
881 repo: {name: bar, url: http://localhost:3123}
882 ''',
883 '''
884 name: bar
885 version: 1.0.0
886 dependencies:
887 baz:
888 version: "<2.0.0"
889 repo: {name: baz, url: http://localhost:3123}
890 ''',
891 '''
892 name: baz
893 version: 1.0.0
894 dependencies:
895 qux:
896 version: "<2.0.0"
897 repo: {name: qux, url: http://localhost:3123}
898 ''',
899 '''
900 name: qux
901 version: 1.0.0
902 ''']);
565 903
566 appDir([dependency("foo")]).scheduleCreate(); 904 dir(appPath, [
905 file('pubspec.yaml', '''
906 dependencies:
907 foo:
908 repo: {name: foo, url: http://localhost:3123}
909 ''')
910 ]).scheduleCreate();
567 911
568 schedulePub(args: ['install'], 912 schedulePub(args: ['install'],
569 output: const RegExp(@"Dependencies installed!$")); 913 output: const RegExp(@"Dependencies installed!$"));
570 914
571 packagesDir({ 915 dir(packagesPath, [
572 "foo": "1.0.0", 916 dir('foo', [
573 "bar": "1.0.0", 917 file('foo.dart', 'main() => print("foo 1.0.0");')
574 "baz": "1.0.0", 918 ]),
575 "qux": "1.0.0" 919 dir('bar', [
576 }).scheduleValidate(); 920 file('bar.dart', 'main() => print("bar 1.0.0");')
921 ]),
922 dir('baz', [
923 file('baz.dart', 'main() => print("baz 1.0.0");')
924 ]),
925 dir('qux', [
926 file('qux.dart', 'main() => print("qux 1.0.0");')
927 ])
928 ]).scheduleValidate();
577 929
578 servePackages("localhost", 3123, [ 930 servePackages("localhost", 3123, [
579 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]), 931 '''
580 package("foo", "2.0.0", [dependency("bar", "<3.0.0")]), 932 name: foo
933 version: 1.0.0
934 dependencies:
935 bar:
936 version: "<2.0.0"
937 repo: {name: bar, url: http://localhost:3123}
938 ''',
939 '''
940 name: foo
941 version: 2.0.0
942 dependencies:
943 bar:
944 version: "<3.0.0"
945 repo: {name: bar, url: http://localhost:3123}
946 ''',
947 '''
948 name: bar
949 version: 1.0.0
950 dependencies:
951 baz:
952 version: "<2.0.0"
953 repo: {name: baz, url: http://localhost:3123}
954 ''',
955 '''
956 name: bar
957 version: 2.0.0
958 dependencies:
959 baz:
960 version: "<3.0.0"
961 repo: {name: baz, url: http://localhost:3123}
962 ''',
963 '''
964 name: baz
965 version: 1.0.0
966 dependencies:
967 qux:
968 version: "<2.0.0"
969 repo: {name: qux, url: http://localhost:3123}
970 ''',
971 '''
972 name: baz
973 version: 2.0.0
974 dependencies:
975 qux:
976 version: "<3.0.0"
977 repo: {name: qux, url: http://localhost:3123}
978 ''',
979 '''
980 name: qux
981 version: 1.0.0
982 ''',
983 '''
984 name: qux
985 version: 2.0.0
986 ''',
987 '''
988 name: newdep
989 version: 2.0.0
990 dependencies:
991 baz:
992 version: ">=1.5.0"
993 repo: {name: baz, url: http://localhost:3123}
994 ''']);
581 995
582 package("bar", "1.0.0", [dependency("baz", "<2.0.0")]), 996 dir(appPath, [
583 package("bar", "2.0.0", [dependency("baz", "<3.0.0")]), 997 file('pubspec.yaml', '''
584 998 dependencies:
585 package("baz", "1.0.0", [dependency("qux", "<2.0.0")]), 999 foo:
586 package("baz", "2.0.0", [dependency("qux", "<3.0.0")]), 1000 repo: {name: foo, url: http://localhost:3123}
587 1001 newdep:
588 package("qux", "1.0.0"), 1002 repo: {name: newdep, url: http://localhost:3123}
589 package("qux", "2.0.0"), 1003 ''')
590 1004 ]).scheduleCreate();
591 package("newdep", "2.0.0", [dependency("baz", ">=1.5.0")])
592 ]);
593
594 appDir([dependency("foo"), dependency("newdep")]).scheduleCreate();
595 1005
596 schedulePub(args: ['install'], 1006 schedulePub(args: ['install'],
597 output: const RegExp(@"Dependencies installed!$")); 1007 output: const RegExp(@"Dependencies installed!$"));
598 1008
599 packagesDir({ 1009 dir(packagesPath, [
600 "foo": "2.0.0", 1010 dir('foo', [
601 "bar": "2.0.0", 1011 file('foo.dart', 'main() => print("foo 2.0.0");')
602 "baz": "2.0.0", 1012 ]),
603 "qux": "1.0.0", 1013 dir('bar', [
604 "newdep": "2.0.0" 1014 file('bar.dart', 'main() => print("bar 2.0.0");')
605 }).scheduleValidate(); 1015 ]),
1016 dir('baz', [
1017 file('baz.dart', 'main() => print("baz 2.0.0");')
1018 ]),
1019 dir('qux', [
1020 file('qux.dart', 'main() => print("qux 1.0.0");')
1021 ]),
1022 dir('newdep', [
1023 file('newdep.dart', 'main() => print("newdep 2.0.0");')
1024 ])
1025 ]).scheduleValidate();
606 1026
607 run(); 1027 run();
608 }); 1028 });
609 1029
610 test("doesn't unlock dependencies if a new dependency is already " 1030 test("doesn't unlock dependencies if a new dependency is already "
611 "satisfied", () { 1031 "satisfied", () {
612 servePackages("localhost", 3123, [ 1032 servePackages("localhost", 3123, [
613 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]), 1033 '''
614 package("bar", "1.0.0", [dependency("baz", "<2.0.0")]), 1034 name: foo
615 package("baz", "1.0.0") 1035 version: 1.0.0
616 ]); 1036 dependencies:
1037 bar:
1038 version: "<2.0.0"
1039 repo: {name: bar, url: http://localhost:3123}
1040 ''',
1041 '''
1042 name: bar
1043 version: 1.0.0
1044 dependencies:
1045 baz:
1046 version: "<2.0.0"
1047 repo: {name: baz, url: http://localhost:3123}
1048 ''',
1049 '''
1050 name: baz
1051 version: 1.0.0
1052 ''']);
617 1053
618 appDir([dependency("foo")]).scheduleCreate(); 1054 dir(appPath, [
1055 file('pubspec.yaml', '''
1056 dependencies:
1057 foo:
1058 repo: {name: foo, url: http://localhost:3123}
1059 ''')
1060 ]).scheduleCreate();
619 1061
620 schedulePub(args: ['install'], 1062 schedulePub(args: ['install'],
621 output: const RegExp(@"Dependencies installed!$")); 1063 output: const RegExp(@"Dependencies installed!$"));
622 1064
623 packagesDir({ 1065 dir(packagesPath, [
624 "foo": "1.0.0", 1066 dir('foo', [
625 "bar": "1.0.0", 1067 file('foo.dart', 'main() => print("foo 1.0.0");')
626 "baz": "1.0.0" 1068 ]),
627 }).scheduleValidate(); 1069 dir('bar', [
1070 file('bar.dart', 'main() => print("bar 1.0.0");')
1071 ]),
1072 dir('baz', [
1073 file('baz.dart', 'main() => print("baz 1.0.0");')
1074 ])
1075 ]).scheduleValidate();
628 1076
629 servePackages("localhost", 3123, [ 1077 servePackages("localhost", 3123, [
630 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]), 1078 '''
631 package("foo", "2.0.0", [dependency("bar", "<3.0.0")]), 1079 name: foo
1080 version: 1.0.0
1081 dependencies:
1082 bar:
1083 version: "<2.0.0"
1084 repo: {name: bar, url: http://localhost:3123}
1085 ''',
1086 '''
1087 name: foo
1088 version: 2.0.0
1089 dependencies:
1090 bar:
1091 version: "<3.0.0"
1092 repo: {name: bar, url: http://localhost:3123}
1093 ''',
1094 '''
1095 name: bar
1096 version: 1.0.0
1097 dependencies:
1098 baz:
1099 version: "<2.0.0"
1100 repo: {name: baz, url: http://localhost:3123}
1101 ''',
1102 '''
1103 name: bar
1104 version: 2.0.0
1105 dependencies:
1106 baz:
1107 version: "<3.0.0"
1108 repo: {name: baz, url: http://localhost:3123}
1109 ''',
1110 '''
1111 name: baz
1112 version: 1.0.0
1113 ''',
1114 '''
1115 name: baz
1116 version: 2.0.0
1117 ''',
1118 '''
1119 name: newdep
1120 version: 2.0.0
1121 dependencies:
1122 baz:
1123 version: ">=1.0.0"
1124 repo: {name: baz, url: http://localhost:3123}
1125 ''']);
632 1126
633 package("bar", "1.0.0", [dependency("baz", "<2.0.0")]), 1127 dir(appPath, [
634 package("bar", "2.0.0", [dependency("baz", "<3.0.0")]), 1128 file('pubspec.yaml', '''
635 1129 dependencies:
636 package("baz", "1.0.0"), 1130 foo:
637 package("baz", "2.0.0"), 1131 repo: {name: foo, url: http://localhost:3123}
638 1132 newdep:
639 package("newdep", "2.0.0", [dependency("baz", ">=1.0.0")]) 1133 repo: {name: newdep, url: http://localhost:3123}
640 ]); 1134 ''')
641 1135 ]).scheduleCreate();
642 appDir([dependency("foo"), dependency("newdep")]).scheduleCreate();
643 1136
644 schedulePub(args: ['install'], 1137 schedulePub(args: ['install'],
645 output: const RegExp(@"Dependencies installed!$")); 1138 output: const RegExp(@"Dependencies installed!$"));
646 1139
647 packagesDir({ 1140 dir(packagesPath, [
648 "foo": "1.0.0", 1141 dir('foo', [
649 "bar": "1.0.0", 1142 file('foo.dart', 'main() => print("foo 1.0.0");')
650 "baz": "1.0.0", 1143 ]),
651 "newdep": "2.0.0" 1144 dir('bar', [
652 }).scheduleValidate(); 1145 file('bar.dart', 'main() => print("bar 1.0.0");')
1146 ]),
1147 dir('baz', [
1148 file('baz.dart', 'main() => print("baz 1.0.0");')
1149 ]),
1150 dir('newdep', [
1151 file('newdep.dart', 'main() => print("newdep 2.0.0");')
1152 ])
1153 ]).scheduleValidate();
653 1154
654 run(); 1155 run();
655 }); 1156 });
656 } 1157 }
657 1158
658 updateCommand() { 1159 updateCommand() {
659 test("updates locked Git packages", () { 1160 test("updates locked Git packages", () {
660 ensureGit(); 1161 ensureGit();
661 1162
662 git('foo.git', [ 1163 git('foo.git', [
663 file('foo.dart', 'main() => "foo";') 1164 file('foo.dart', 'main() => "foo";')
664 ]).scheduleCreate(); 1165 ]).scheduleCreate();
665 1166
666 git('bar.git', [ 1167 git('bar.git', [
667 file('bar.dart', 'main() => "bar";') 1168 file('bar.dart', 'main() => "bar";')
668 ]).scheduleCreate(); 1169 ]).scheduleCreate();
669 1170
670 appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate(); 1171 dir(appPath, [
1172 file('pubspec.yaml', '''
1173 dependencies:
1174 foo:
1175 git: ../foo.git
1176 bar:
1177 git: ../bar.git
1178 ''')
1179 ]).scheduleCreate();
671 1180
672 schedulePub(args: ['install'], 1181 schedulePub(args: ['install'],
673 output: const RegExp(@"Dependencies installed!$")); 1182 output: const RegExp(@"Dependencies installed!$"));
674 1183
675 dir(packagesPath, [ 1184 dir(packagesPath, [
676 dir('foo', [ 1185 dir('foo', [
677 file('foo.dart', 'main() => "foo";') 1186 file('foo.dart', 'main() => "foo";')
678 ]), 1187 ]),
679 dir('bar', [ 1188 dir('bar', [
680 file('bar.dart', 'main() => "bar";') 1189 file('bar.dart', 'main() => "bar";')
(...skipping 28 matching lines...) Expand all
709 ensureGit(); 1218 ensureGit();
710 1219
711 git('foo.git', [ 1220 git('foo.git', [
712 file('foo.dart', 'main() => "foo";') 1221 file('foo.dart', 'main() => "foo";')
713 ]).scheduleCreate(); 1222 ]).scheduleCreate();
714 1223
715 git('bar.git', [ 1224 git('bar.git', [
716 file('bar.dart', 'main() => "bar";') 1225 file('bar.dart', 'main() => "bar";')
717 ]).scheduleCreate(); 1226 ]).scheduleCreate();
718 1227
719 appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate(); 1228 dir(appPath, [
1229 file('pubspec.yaml', '''
1230 dependencies:
1231 foo:
1232 git: ../foo.git
1233 bar:
1234 git: ../bar.git
1235 ''')
1236 ]).scheduleCreate();
720 1237
721 schedulePub(args: ['install'], 1238 schedulePub(args: ['install'],
722 output: const RegExp(@"Dependencies installed!$")); 1239 output: const RegExp(@"Dependencies installed!$"));
723 1240
724 dir(packagesPath, [ 1241 dir(packagesPath, [
725 dir('foo', [ 1242 dir('foo', [
726 file('foo.dart', 'main() => "foo";') 1243 file('foo.dart', 'main() => "foo";')
727 ]), 1244 ]),
728 dir('bar', [ 1245 dir('bar', [
729 file('bar.dart', 'main() => "bar";') 1246 file('bar.dart', 'main() => "bar";')
(...skipping 22 matching lines...) Expand all
752 1269
753 run(); 1270 run();
754 }); 1271 });
755 1272
756 test("doesn't update one locked Git package's dependencies if it's not " 1273 test("doesn't update one locked Git package's dependencies if it's not "
757 "necessary", () { 1274 "necessary", () {
758 ensureGit(); 1275 ensureGit();
759 1276
760 git('foo.git', [ 1277 git('foo.git', [
761 file('foo.dart', 'main() => "foo";'), 1278 file('foo.dart', 'main() => "foo";'),
762 libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}]) 1279 file('pubspec.yaml', '''
1280 dependencies:
1281 foo-dep:
1282 git: ../foo-dep.git
1283 ''')
763 ]).scheduleCreate(); 1284 ]).scheduleCreate();
764 1285
765 git('foo-dep.git', [ 1286 git('foo-dep.git', [
766 file('foo-dep.dart', 'main() => "foo-dep";'), 1287 file('foo-dep.dart', 'main() => "foo-dep";')
767 ]).scheduleCreate(); 1288 ]).scheduleCreate();
768 1289
769 appDir([{"git": "../foo.git"}]).scheduleCreate(); 1290 dir(appPath, [
1291 file('pubspec.yaml', '''
1292 dependencies:
1293 foo:
1294 git: ../foo.git
1295 ''')
1296 ]).scheduleCreate();
770 1297
771 schedulePub(args: ['install'], 1298 schedulePub(args: ['install'],
772 output: const RegExp(@"Dependencies installed!$")); 1299 output: const RegExp(@"Dependencies installed!$"));
773 1300
774 dir(packagesPath, [ 1301 dir(packagesPath, [
775 dir('foo', [ 1302 dir('foo', [
776 file('foo.dart', 'main() => "foo";'), 1303 file('foo.dart', 'main() => "foo";'),
777 libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}]) 1304 file('pubspec.yaml', '''
1305 dependencies:
1306 foo-dep:
1307 git: ../foo-dep.git
1308 ''')
778 ]), 1309 ]),
779 dir('foo-dep', [ 1310 dir('foo-dep', [
780 file('foo-dep.dart', 'main() => "foo-dep";') 1311 file('foo-dep.dart', 'main() => "foo-dep";')
781 ]) 1312 ])
782 ]).scheduleValidate(); 1313 ]).scheduleValidate();
783 1314
784 git('foo.git', [ 1315 git('foo.git', [
785 file('foo.dart', 'main() => "foo 2";'), 1316 file('foo.dart', 'main() => "foo 2";'),
786 libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}]) 1317 file('pubspec.yaml', '''
1318 dependencies:
1319 foo-dep:
1320 git: ../foo-dep.git
1321 ''')
787 ]).scheduleCreate(); 1322 ]).scheduleCreate();
788 1323
789 git('foo-dep.git', [ 1324 git('foo-dep.git', [
790 file('foo-dep.dart', 'main() => "foo-dep 2";') 1325 file('foo-dep.dart', 'main() => "foo-dep 2";')
791 ]).scheduleCommit(); 1326 ]).scheduleCommit();
792 1327
793 schedulePub(args: ['update', 'foo'], 1328 schedulePub(args: ['update', 'foo'],
794 output: const RegExp(@"Dependencies updated!$")); 1329 output: const RegExp(@"Dependencies updated!$"));
795 1330
796 dir(packagesPath, [ 1331 dir(packagesPath, [
797 dir('foo', [ 1332 dir('foo', [
798 file('foo.dart', 'main() => "foo 2";'), 1333 file('foo.dart', 'main() => "foo 2";'),
799 libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}]) 1334 file('pubspec.yaml', '''
1335 dependencies:
1336 foo-dep:
1337 git: ../foo-dep.git
1338 ''')
800 ]), 1339 ]),
801 dir('foo-dep', [ 1340 dir('foo-dep', [
802 file('foo-dep.dart', 'main() => "foo-dep";') 1341 file('foo-dep.dart', 'main() => "foo-dep";')
803 ]), 1342 ]),
804 ]).scheduleValidate(); 1343 ]).scheduleValidate();
805 1344
806 run(); 1345 run();
807 }); 1346 });
808 1347
809 test("updates one locked pub server package's dependencies if it's " 1348 test("updates one locked pub server package's dependencies if it's "
810 "necessary", () { 1349 "necessary", () {
811 servePackages("localhost", 3123, [ 1350 servePackages("localhost", 3123, [
812 package("foo", "1.0.0", [dependency("foo-dep")]), 1351 '''
813 package("foo-dep", "1.0.0") 1352 name: foo
1353 version: 1.0.0
1354 dependencies:
1355 foo-dep:
1356 repo:
1357 name: foo-dep
1358 url: http://localhost:3123
1359 ''',
1360 '{name: foo-dep, version: 1.0.0}'
814 ]); 1361 ]);
815 1362
816 appDir([dependency("foo")]).scheduleCreate(); 1363 dir(appPath, [
1364 file('pubspec.yaml', '''
1365 dependencies:
1366 foo:
1367 repo:
1368 name: foo
1369 url: http://localhost:3123
1370 ''')
1371 ]).scheduleCreate();
817 1372
818 schedulePub(args: ['install'], 1373 schedulePub(args: ['install'],
819 output: const RegExp(@"Dependencies installed!$")); 1374 output: const RegExp(@"Dependencies installed!$"));
820 1375
821 packagesDir({ 1376 dir(packagesPath, [
822 "foo": "1.0.0", 1377 dir('foo', [
823 "foo-dep": "1.0.0" 1378 file('foo.dart', 'main() => print("foo 1.0.0");'),
824 }).scheduleValidate(); 1379 file('pubspec.yaml', '''
1380 name: foo
1381 version: 1.0.0
1382 dependencies:
1383 foo-dep:
1384 repo:
1385 name: foo-dep
1386 url: http://localhost:3123
1387 ''')
1388 ]),
1389 dir('foo-dep', [
1390 file('foo-dep.dart', 'main() => print("foo-dep 1.0.0");')
1391 ])
1392 ]).scheduleValidate();
825 1393
826 servePackages("localhost", 3123, [ 1394 servePackages("localhost", 3123, [
827 package("foo", "2.0.0", [dependency("foo-dep", ">1.0.0")]), 1395 '''
828 package("foo-dep", "2.0.0") 1396 name: foo
1397 version: 2.0.0
1398 dependencies:
1399 foo-dep:
1400 repo: {name: foo-dep, url: http://localhost:3123}
1401 version: ">1.0.0"
1402 ''',
1403 '{name: foo-dep, version: 2.0.0}'
829 ]); 1404 ]);
830 1405
831 schedulePub(args: ['update', 'foo'], 1406 schedulePub(args: ['update', 'foo'],
832 output: const RegExp(@"Dependencies updated!$")); 1407 output: const RegExp(@"Dependencies updated!$"));
833 1408
834 packagesDir({ 1409 dir(packagesPath, [
835 "foo": "2.0.0", 1410 dir('foo', [
836 "foo-dep": "2.0.0" 1411 file('foo.dart', 'main() => print("foo 2.0.0");'),
837 }).scheduleValidate(); 1412 file('pubspec.yaml', '''
1413 name: foo
1414 version: 2.0.0
1415 dependencies:
1416 foo-dep:
1417 repo: {name: foo-dep, url: http://localhost:3123}
1418 version: ">1.0.0"
1419 ''')
1420 ]),
1421 dir('foo-dep', [
1422 file('foo-dep.dart', 'main() => print("foo-dep 2.0.0");')
1423 ])
1424 ]).scheduleValidate();
838 1425
839 run(); 1426 run();
840 }); 1427 });
841 1428
842 test("updates a locked package's dependers in order to get it to max " 1429 test("updates a locked package's dependers in order to get it to max "
843 "version", () { 1430 "version", () {
844 servePackages("localhost", 3123, [ 1431 servePackages("localhost", 3123, [
845 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]), 1432 '''
846 package("bar", "1.0.0") 1433 name: foo
1434 version: 1.0.0
1435 dependencies:
1436 bar:
1437 version: "<2.0.0"
1438 repo: {name: bar, url: http://localhost:3123}
1439 ''',
1440 '{name: bar, version: 1.0.0}'
847 ]); 1441 ]);
848 1442
849 appDir([dependency("foo"), dependency("bar")]).scheduleCreate(); 1443 dir(appPath, [
1444 file('pubspec.yaml', '''
1445 dependencies:
1446 foo:
1447 repo: {name: foo, url: http://localhost:3123}
1448 bar:
1449 repo: {name: bar, url: http://localhost:3123}
1450 ''')
1451 ]).scheduleCreate();
850 1452
851 schedulePub(args: ['install'], 1453 schedulePub(args: ['install'],
852 output: const RegExp(@"Dependencies installed!$")); 1454 output: const RegExp(@"Dependencies installed!$"));
853 1455
854 packagesDir({ 1456 dir(packagesPath, [
855 "foo": "1.0.0", 1457 dir('foo', [
856 "bar": "1.0.0" 1458 file('foo.dart', 'main() => print("foo 1.0.0");'),
857 }).scheduleValidate(); 1459 ]),
1460 dir('bar', [
1461 file('bar.dart', 'main() => print("bar 1.0.0");')
1462 ])
1463 ]).scheduleValidate();
858 1464
859 servePackages("localhost", 3123, [ 1465 servePackages("localhost", 3123, [
860 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]), 1466 '''
861 package("foo", "2.0.0", [dependency("bar", "<3.0.0")]), 1467 name: foo
862 1468 version: 1.0.0
863 package("bar", "1.0.0"), 1469 dependencies:
864 package("bar", "2.0.0") 1470 bar:
1471 version: "<2.0.0"
1472 repo: {name: bar, url: http://localhost:3123}
1473 ''',
1474 '''
1475 name: foo
1476 version: 2.0.0
1477 dependencies:
1478 bar:
1479 version: "<3.0.0"
1480 repo: {name: bar, url: http://localhost:3123}
1481 ''',
1482 '{name: bar, version: 1.0.0}',
1483 '{name: bar, version: 2.0.0}'
865 ]); 1484 ]);
866 1485
867 schedulePub(args: ['update', 'bar'], 1486 schedulePub(args: ['update', 'bar'],
868 output: const RegExp(@"Dependencies updated!$")); 1487 output: const RegExp(@"Dependencies updated!$"));
869 1488
870 packagesDir({ 1489 dir(packagesPath, [
871 "foo": "2.0.0", 1490 dir('foo', [
872 "bar": "2.0.0" 1491 file('foo.dart', 'main() => print("foo 2.0.0");'),
873 }).scheduleValidate(); 1492 ]),
1493 dir('bar', [
1494 file('bar.dart', 'main() => print("bar 2.0.0");')
1495 ])
1496 ]).scheduleValidate();
874 1497
875 run(); 1498 run();
876 }); 1499 });
877 }); 1500 });
878 } 1501 }
879 1502
880 versionCommand() { 1503 versionCommand() {
881 test('displays the current version', () => 1504 test('displays the current version', () =>
882 runPub(args: ['version'], output: VERSION_STRING)); 1505 runPub(args: ['version'], output: VERSION_STRING));
883 } 1506 }
OLDNEW
« no previous file with comments | « no previous file | utils/tests/pub/test_pub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698