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

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

Issue 10704172: Hook in the version solver to pub install. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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/pub/sdk_source.dart ('k') | 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('../../../lib/unittest/unittest.dart'); 10 #import('../../../lib/unittest/unittest.dart');
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 apple 0.0.0 (apple from sdk) 83 apple 0.0.0 (apple from sdk)
84 banana 0.0.0 (banana from sdk) 84 banana 0.0.0 (banana from sdk)
85 cherry 0.0.0 (cherry from sdk) 85 cherry 0.0.0 (cherry from sdk)
86 '''); 86 ''');
87 }); 87 });
88 }); 88 });
89 */ 89 */
90 } 90 }
91 91
92 installCommand() { 92 installCommand() {
93 test('adds a dependent package', () { 93 test('checks out a package from the SDK', () {
94 dir(sdkPath, [ 94 dir(sdkPath, [
95 file('revision', '1234'),
95 dir('lib', [ 96 dir('lib', [
96 dir('foo', [ 97 dir('foo', [
97 file('foo.dart', 'main() => "foo";') 98 file('foo.dart', 'main() => "foo";')
98 ]) 99 ])
99 ]) 100 ])
100 ]).scheduleCreate(); 101 ]).scheduleCreate();
101 102
102 dir(appPath, [ 103 dir(appPath, [
103 file('pubspec.yaml', 'dependencies:\n foo:') 104 file('pubspec.yaml', 'dependencies:\n foo:')
104 ]).scheduleCreate(); 105 ]).scheduleCreate();
105 106
106 schedulePub(args: ['install'], 107 schedulePub(args: ['install'],
107 output: ''' 108 output: '''
108 Dependencies installed! 109 Dependencies installed!
109 '''); 110 ''');
110 111
111 dir(packagesPath, [ 112 dir(packagesPath, [
112 dir('foo', [ 113 dir('foo', [
113 file('foo.dart', 'main() => "foo";') 114 file('foo.dart', 'main() => "foo";')
114 ]) 115 ])
115 ]).scheduleValidate(); 116 ]).scheduleValidate();
116 117
117 run(); 118 run();
118 }); 119 });
119 120
120 test('adds a transitively dependent package', () {
121 dir(sdkPath, [
122 dir('lib', [
123 dir('foo', [
124 file('foo.dart', 'main() => "foo";'),
125 file('pubspec.yaml', 'dependencies:\n bar:')
126 ]),
127 dir('bar', [
128 file('bar.dart', 'main() => "bar";'),
129 ])
130 ])
131 ]).scheduleCreate();
132
133 dir(appPath, [
134 file('pubspec.yaml', 'dependencies:\n foo:')
135 ]).scheduleCreate();
136
137 schedulePub(args: ['install'],
138 output: '''
139 Dependencies installed!
140 ''');
141
142 dir(packagesPath, [
143 dir('foo', [
144 file('foo.dart', 'main() => "foo";')
145 ]),
146 dir('bar', [
147 file('bar.dart', 'main() => "bar";'),
148 ])
149 ]).scheduleValidate();
150
151 run();
152 });
153
154 test('checks out a package from Git', () { 121 test('checks out a package from Git', () {
155 withGit(() { 122 withGit(() {
156 git('foo.git', [ 123 git('foo.git', [
157 file('foo.dart', 'main() => "foo";') 124 file('foo.dart', 'main() => "foo";')
158 ]).scheduleCreate(); 125 ]).scheduleCreate();
159 126
160 dir(appPath, [ 127 dir(appPath, [
161 file('pubspec.yaml', ''' 128 file('pubspec.yaml', '''
162 dependencies: 129 dependencies:
163 foo: 130 foo:
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 file('foo.dart', 'main() => print("foo 1.2.3");') 440 file('foo.dart', 'main() => print("foo 1.2.3");')
474 ]), 441 ]),
475 dir('bar', [ 442 dir('bar', [
476 file('pubspec.yaml', '{name: bar, version: 2.0.4}'), 443 file('pubspec.yaml', '{name: bar, version: 2.0.4}'),
477 file('bar.dart', 'main() => print("bar 2.0.4");') 444 file('bar.dart', 'main() => print("bar 2.0.4");')
478 ]) 445 ])
479 ]).scheduleValidate(); 446 ]).scheduleValidate();
480 447
481 run(); 448 run();
482 }); 449 });
450
451 test('resolves version constraints from a pub server', () {
452 servePackages("localhost", 3123, [
453 '''
454 name: foo
455 version: 1.2.3
456 dependencies:
457 baz:
458 repo: {name: baz, url: http://localhost:3123}
459 version: ">=2.0.0"
460 ''',
461 '''
462 name: bar
463 version: 2.3.4
464 dependencies:
465 baz:
466 repo: {name: baz, url: http://localhost:3123}
467 version: "<3.0.0"
468 ''',
469 '{name: baz, version: 2.0.3}',
470 '{name: baz, version: 2.0.4}',
471 '{name: baz, version: 3.0.1}',
472 ]);
473
474 dir(appPath, [
475 file('pubspec.yaml', '''
476 dependencies:
477 foo: {repo: {name: foo, url: http://localhost:3123}}
478 bar: {repo: {name: bar, url: http://localhost:3123}}
479 ''')
480 ]).scheduleCreate();
481
482 schedulePub(args: ['install'],
483 output: const RegExp("Dependencies installed!\$"));
484
485 dir(cachePath, [
486 dir('repo', [
487 dir('localhost%583123', [
488 dir('foo-1.2.3', [
489 file('pubspec.yaml', '''
490 name: foo
491 version: 1.2.3
492 dependencies:
493 baz:
494 repo: {name: baz, url: http://localhost:3123}
495 version: ">=2.0.0"
496 '''),
497 file('foo.dart', 'main() => print("foo 1.2.3");')
498 ]),
499 dir('bar-2.3.4', [
500 file('pubspec.yaml', '''
501 name: bar
502 version: 2.3.4
503 dependencies:
504 baz:
505 repo: {name: baz, url: http://localhost:3123}
506 version: "<3.0.0"
507 '''),
508 file('bar.dart', 'main() => print("bar 2.3.4");')
509 ]),
510 dir('baz-2.0.4', [
511 file('pubspec.yaml', '{name: baz, version: 2.0.4}'),
512 file('baz.dart', 'main() => print("baz 2.0.4");')
513 ])
514 ])
515 ])
516 ]).scheduleValidate();
517
518 dir(packagesPath, [
519 dir('foo', [
520 file('pubspec.yaml', '''
521 name: foo
522 version: 1.2.3
523 dependencies:
524 baz:
525 repo: {name: baz, url: http://localhost:3123}
526 version: ">=2.0.0"
527 '''),
528 file('foo.dart', 'main() => print("foo 1.2.3");')
529 ]),
530 dir('bar', [
531 file('pubspec.yaml', '''
532 name: bar
533 version: 2.3.4
534 dependencies:
535 baz:
536 repo: {name: baz, url: http://localhost:3123}
537 version: "<3.0.0"
538 '''),
539 file('bar.dart', 'main() => print("bar 2.3.4");')
540 ]),
541 dir('baz', [
542 file('pubspec.yaml', '{name: baz, version: 2.0.4}'),
543 file('baz.dart', 'main() => print("baz 2.0.4");')
544 ])
545 ]).scheduleValidate();
546
547 run();
548 });
483 } 549 }
484 550
485 versionCommand() { 551 versionCommand() {
486 test('displays the current version', () => 552 test('displays the current version', () =>
487 runPub(args: ['version'], output: VERSION_STRING)); 553 runPub(args: ['version'], output: VERSION_STRING));
488 } 554 }
OLDNEW
« no previous file with comments | « utils/pub/sdk_source.dart ('k') | utils/tests/pub/test_pub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698