Chromium Code Reviews| Index: utils/tests/pub/pub_test.dart |
| diff --git a/utils/tests/pub/pub_test.dart b/utils/tests/pub/pub_test.dart |
| index ca65c1d9c7b077e1f082b4b83f7ca190d0e00099..73f44df4be358b57cdd4fb63117eb4ba94c5fe26 100644 |
| --- a/utils/tests/pub/pub_test.dart |
| +++ b/utils/tests/pub/pub_test.dart |
| @@ -868,6 +868,134 @@ dependencies: |
| run(); |
| }); |
| + |
| + test("unlocks dependencies if necessary to ensure that a new dependency " |
| + "is satisfied", () { |
|
Bob Nystrom
2012/08/15 17:48:16
I'd like to also have a test to ensure that depend
nweiz
2012/08/15 21:25:42
Done.
|
| + servePackages("localhost", 3123, [ |
| + ''' |
| +name: foo |
| +version: 1.0.0 |
| +dependencies: |
| + bar: |
| + version: "<2.0.0" |
| + repo: {name: bar, url: http://localhost:3123} |
| +''', |
| + ''' |
| +name: bar |
| +version: 1.0.0 |
| +dependencies: |
| + baz: |
| + version: "<2.0.0" |
| + repo: {name: baz, url: http://localhost:3123} |
| +''', |
| + ''' |
| +name: baz |
| +version: 1.0.0 |
| +''']); |
| + |
| + dir(appPath, [ |
| + file('pubspec.yaml', ''' |
| +dependencies: |
| + foo: |
| + repo: {name: foo, url: http://localhost:3123} |
| +''') |
| + ]).scheduleCreate(); |
| + |
| + schedulePub(args: ['install'], |
| + output: const RegExp(@"Dependencies installed!$")); |
| + |
| + dir(packagesPath, [ |
| + dir('foo', [ |
| + file('foo.dart', 'main() => print("foo 1.0.0");') |
| + ]), |
| + dir('bar', [ |
| + file('bar.dart', 'main() => print("bar 1.0.0");') |
| + ]), |
| + dir('baz', [ |
| + file('baz.dart', 'main() => print("baz 1.0.0");') |
| + ]) |
| + ]).scheduleValidate(); |
| + |
| + servePackages("localhost", 3123, [ |
| + ''' |
| +name: foo |
| +version: 1.0.0 |
| +dependencies: |
| + bar: |
| + version: "<2.0.0" |
| + repo: {name: bar, url: http://localhost:3123} |
| +''', |
| + ''' |
| +name: foo |
| +version: 2.0.0 |
| +dependencies: |
| + bar: |
| + version: "<3.0.0" |
| + repo: {name: bar, url: http://localhost:3123} |
| +''', |
| + ''' |
| +name: bar |
| +version: 1.0.0 |
| +dependencies: |
| + baz: |
| + version: "<2.0.0" |
| + repo: {name: baz, url: http://localhost:3123} |
| +''', |
| + ''' |
| +name: bar |
| +version: 2.0.0 |
| +dependencies: |
| + baz: |
| + version: "<3.0.0" |
| + repo: {name: baz, url: http://localhost:3123} |
| +''', |
| + ''' |
| +name: baz |
| +version: 1.0.0 |
| +''', |
| + ''' |
| +name: baz |
| +version: 2.0.0 |
| +''', |
| + ''' |
| +name: newdep |
| +version: 2.0.0 |
| +dependencies: |
| + baz: |
| + version: ">=1.5.0" |
| + repo: {name: baz, url: http://localhost:3123} |
| +''']); |
| + |
| + dir(appPath, [ |
| + file('pubspec.yaml', ''' |
| +dependencies: |
| + foo: |
| + repo: {name: foo, url: http://localhost:3123} |
| + newdep: |
| + repo: {name: newdep, url: http://localhost:3123} |
| +''') |
| + ]).scheduleCreate(); |
| + |
| + schedulePub(args: ['install'], |
| + output: const RegExp(@"Dependencies installed!$")); |
| + |
| + dir(packagesPath, [ |
| + dir('foo', [ |
| + file('foo.dart', 'main() => print("foo 2.0.0");') |
|
Bob Nystrom
2012/08/15 17:48:16
Since servePackages() automatically generates thes
nweiz
2012/08/15 21:25:42
I agree. I'm vaguely planning on doing a test clea
|
| + ]), |
| + dir('bar', [ |
| + file('bar.dart', 'main() => print("bar 2.0.0");') |
| + ]), |
| + dir('baz', [ |
| + file('baz.dart', 'main() => print("baz 2.0.0");') |
| + ]), |
| + dir('newdep', [ |
| + file('newdep.dart', 'main() => print("newdep 2.0.0");') |
| + ]) |
| + ]).scheduleValidate(); |
| + |
| + run(); |
| + }); |
| } |
| updateCommand() { |
| @@ -1139,6 +1267,78 @@ dependencies: |
| run(); |
| }); |
| + |
| + test("updates a locked package's dependers in order to get it to max " |
| + "version", () { |
| + servePackages("localhost", 3123, [ |
| + ''' |
| +name: foo |
| +version: 1.0.0 |
| +dependencies: |
| + bar: |
| + version: "<2.0.0" |
| + repo: {name: bar, url: http://localhost:3123} |
| +''', |
| + '{name: bar, version: 1.0.0}' |
| + ]); |
| + |
| + dir(appPath, [ |
| + file('pubspec.yaml', ''' |
| +dependencies: |
| + foo: |
| + repo: {name: foo, url: http://localhost:3123} |
| + bar: |
| + repo: {name: bar, url: http://localhost:3123} |
| +''') |
| + ]).scheduleCreate(); |
| + |
| + schedulePub(args: ['install'], |
| + output: const RegExp(@"Dependencies installed!$")); |
| + |
| + dir(packagesPath, [ |
| + dir('foo', [ |
| + file('foo.dart', 'main() => print("foo 1.0.0");'), |
| + ]), |
| + dir('bar', [ |
| + file('bar.dart', 'main() => print("bar 1.0.0");') |
| + ]) |
| + ]).scheduleValidate(); |
| + |
| + servePackages("localhost", 3123, [ |
| + ''' |
| +name: foo |
| +version: 1.0.0 |
| +dependencies: |
| + bar: |
| + version: "<2.0.0" |
| + repo: {name: bar, url: http://localhost:3123} |
| +''', |
| + ''' |
| +name: foo |
| +version: 2.0.0 |
| +dependencies: |
| + bar: |
| + version: "<3.0.0" |
| + repo: {name: bar, url: http://localhost:3123} |
| +''', |
| + '{name: bar, version: 1.0.0}', |
| + '{name: bar, version: 2.0.0}' |
| + ]); |
| + |
| + schedulePub(args: ['update', 'bar'], |
| + output: const RegExp(@"Dependencies updated!$")); |
| + |
| + dir(packagesPath, [ |
| + dir('foo', [ |
| + file('foo.dart', 'main() => print("foo 2.0.0");'), |
| + ]), |
| + dir('bar', [ |
| + file('bar.dart', 'main() => print("bar 2.0.0");') |
| + ]) |
| + ]).scheduleValidate(); |
| + |
| + run(); |
| + }); |
| }); |
| } |