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

Unified Diff: utils/tests/pub/pub_test.dart

Issue 10872050: Reverting 11266 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | utils/tests/pub/test_pub.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/tests/pub/pub_test.dart
diff --git a/utils/tests/pub/pub_test.dart b/utils/tests/pub/pub_test.dart
index 952455d05972f4642b559dc44585acefa8362888..26f71922b15fd9a31eafdfd92e37b9a0765f6d22 100644
--- a/utils/tests/pub/pub_test.dart
+++ b/utils/tests/pub/pub_test.dart
@@ -93,11 +93,15 @@ installCommand() {
test('checks out a package from the SDK', () {
dir(sdkPath, [
file('revision', '1234'),
- dir('pkg', [packageDir("foo", "0.0.1234")])
+ dir('pkg', [
+ dir('foo', [
+ file('foo.dart', 'main() => "foo";')
+ ])
+ ])
]).scheduleCreate();
dir(appPath, [
- pubspec({"dependencies": {"foo": null}})
+ file('pubspec.yaml', 'dependencies:\n foo:')
]).scheduleCreate();
schedulePub(args: ['install'],
@@ -105,7 +109,11 @@ installCommand() {
Dependencies installed!
''');
- packagesDir({"foo": "0.0.1234"}).scheduleValidate();
+ dir(packagesPath, [
+ dir('foo', [
+ file('foo.dart', 'main() => "foo";')
+ ])
+ ]).scheduleValidate();
run();
});
@@ -117,15 +125,27 @@ installCommand() {
file('foo.dart', 'main() => "foo";')
]).scheduleCreate();
- appDir([{"git": "../foo.git"}]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ git: ../foo.git
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
dir(cachePath, [
dir('git', [
- dir('cache', [gitPackageCacheDir('foo')]),
- gitPackageCacheDir('foo')
+ dir('cache', [
+ dir(new RegExp(@'foo-[a-f0-9]+'), [
+ file('foo.dart', 'main() => "foo";')
+ ])
+ ]),
+ dir(new RegExp(@'foo-[a-f0-9]+'), [
+ file('foo.dart', 'main() => "foo";')
+ ])
])
]).scheduleValidate();
@@ -143,14 +163,24 @@ installCommand() {
git('foo.git', [
file('foo.dart', 'main() => "foo";'),
- appPubspec([{"git": "../bar.git"}])
+ file('pubspec.yaml', '''
+dependencies:
+ bar:
+ git: ../bar.git
+''')
]).scheduleCreate();
git('bar.git', [
file('bar.dart', 'main() => "bar";')
]).scheduleCreate();
- appDir([{"git": "../foo.git"}]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ git: ../foo.git
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp("Dependencies installed!\$"));
@@ -158,11 +188,19 @@ installCommand() {
dir(cachePath, [
dir('git', [
dir('cache', [
- gitPackageCacheDir('foo'),
- gitPackageCacheDir('bar')
+ dir(new RegExp(@'foo-[a-f0-9]+'), [
+ file('foo.dart', 'main() => "foo";')
+ ]),
+ dir(new RegExp(@'bar-[a-f0-9]+'), [
+ file('bar.dart', 'main() => "bar";')
+ ])
]),
- gitPackageCacheDir('foo'),
- gitPackageCacheDir('bar')
+ dir(new RegExp(@'foo-[a-f0-9]+'), [
+ file('foo.dart', 'main() => "foo";')
+ ]),
+ dir(new RegExp(@'bar-[a-f0-9]+'), [
+ file('bar.dart', 'main() => "bar";')
+ ])
])
]).scheduleValidate();
@@ -185,15 +223,27 @@ installCommand() {
file('foo.dart', 'main() => "foo";')
]).scheduleCreate();
- appDir([{"git": "../foo.git"}]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ git: ../foo.git
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
dir(cachePath, [
dir('git', [
- dir('cache', [gitPackageCacheDir('foo')]),
- gitPackageCacheDir('foo')
+ dir('cache', [
+ dir(new RegExp(@'foo-[a-f0-9]+'), [
+ file('foo.dart', 'main() => "foo";')
+ ])
+ ]),
+ dir(new RegExp(@'foo-[a-f0-9]+'), [
+ file('foo.dart', 'main() => "foo";')
+ ])
])
]).scheduleValidate();
@@ -218,9 +268,17 @@ installCommand() {
// git/cache directory but create a new git/ directory.
dir(cachePath, [
dir('git', [
- dir('cache', [gitPackageCacheDir('foo', 2)]),
- gitPackageCacheDir('foo'),
- gitPackageCacheDir('foo', 2)
+ dir('cache', [
+ dir(new RegExp(@'foo-[a-f0-9]+'), [
+ file('foo.dart', 'main() => "foo 2";')
+ ])
+ ]),
+ dir(new RegExp(@'foo-[a-f0-9]+'), [
+ file('foo.dart', 'main() => "foo";')
+ ]),
+ dir(new RegExp(@'foo-[a-f0-9]+'), [
+ file('foo.dart', 'main() => "foo 2";')
+ ])
])
]).scheduleValidate();
@@ -240,15 +298,27 @@ installCommand() {
file('foo.dart', 'main() => "foo";')
]).scheduleCreate();
- appDir([{"git": "../foo.git"}]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ git: ../foo.git
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
dir(cachePath, [
dir('git', [
- dir('cache', [gitPackageCacheDir('foo')]),
- gitPackageCacheDir('foo')
+ dir('cache', [
+ dir(new RegExp(@'foo-[a-f0-9]+'), [
+ file('foo.dart', 'main() => "foo";')
+ ])
+ ]),
+ dir(new RegExp(@'foo-[a-f0-9]+'), [
+ file('foo.dart', 'main() => "foo";')
+ ])
])
]).scheduleValidate();
@@ -276,13 +346,23 @@ installCommand() {
file('foo.dart', 'main() => "foo 1";')
]);
repo.scheduleCreate();
- var commit = repo.revParse('HEAD');
+ var commitFuture = repo.revParse('HEAD');
git('foo.git', [
file('foo.dart', 'main() => "foo 2";')
]).scheduleCommit();
- appDir([{"git": {"url": "../foo.git", "ref": commit}}]).scheduleCreate();
+ dir(appPath, [
+ async(commitFuture.transform((commit) {
+ return file('pubspec.yaml', '''
+dependencies:
+ foo:
+ git:
+ url: ../foo.git
+ ref: $commit
+''');
+ }))
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
@@ -297,63 +377,210 @@ installCommand() {
});
test('checks out a package from a pub server', () {
- servePackages("localhost", 3123, [package("foo", "1.2.3")]);
+ servePackages("localhost", 3123, ['{name: foo, version: 1.2.3}']);
- appDir([dependency("foo", "1.2.3")]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ repo:
+ name: foo
+ url: http://localhost:3123
+ version: 1.2.3
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp("Dependencies installed!\$"));
- cacheDir({"foo": "1.2.3"}).scheduleValidate();
- packagesDir({"foo": "1.2.3"}).scheduleValidate();
+ dir(cachePath, [
+ dir('repo', [
+ dir('localhost%583123', [
+ dir('foo-1.2.3', [
+ file('pubspec.yaml', '{name: foo, version: 1.2.3}'),
+ file('foo.dart', 'main() => print("foo 1.2.3");')
+ ])
+ ])
+ ])
+ ]).scheduleValidate();
+
+ dir(packagesPath, [
+ dir('foo', [
+ file('pubspec.yaml', '{name: foo, version: 1.2.3}'),
+ file('foo.dart', 'main() => print("foo 1.2.3");')
+ ])
+ ]).scheduleValidate();
run();
});
test('checks out packages transitively from a pub server', () {
servePackages("localhost", 3123, [
- package("foo", "1.2.3", [dependency("bar", "2.0.4")]),
- package("bar", "2.0.3"),
- package("bar", "2.0.4"),
- package("bar", "2.0.5")
+ '''
+name: foo
+version: 1.2.3
+dependencies:
+ bar:
+ repo: {name: bar, url: http://localhost:3123}
+ version: 2.0.4
+''',
+ '{name: bar, version: 2.0.3}',
+ '{name: bar, version: 2.0.4}',
+ '{name: bar, version: 2.0.5}',
]);
- appDir([dependency("foo", "1.2.3")]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ repo:
+ name: foo
+ url: http://localhost:3123
+ version: 1.2.3
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp("Dependencies installed!\$"));
- cacheDir({"foo": "1.2.3", "bar": "2.0.4"}).scheduleValidate();
- packagesDir({"foo": "1.2.3", "bar": "2.0.4"}).scheduleValidate();
+ dir(cachePath, [
+ dir('repo', [
+ dir('localhost%583123', [
+ dir('foo-1.2.3', [
+ file('pubspec.yaml', '''
+name: foo
+version: 1.2.3
+dependencies:
+ bar:
+ repo: {name: bar, url: http://localhost:3123}
+ version: 2.0.4
+'''),
+ file('foo.dart', 'main() => print("foo 1.2.3");')
+ ]),
+ dir('bar-2.0.4', [
+ file('pubspec.yaml', '{name: bar, version: 2.0.4}'),
+ file('bar.dart', 'main() => print("bar 2.0.4");')
+ ])
+ ])
+ ])
+ ]).scheduleValidate();
+
+ dir(packagesPath, [
+ dir('foo', [
+ file('pubspec.yaml', '''
+name: foo
+version: 1.2.3
+dependencies:
+ bar:
+ repo: {name: bar, url: http://localhost:3123}
+ version: 2.0.4
+'''),
+ file('foo.dart', 'main() => print("foo 1.2.3");')
+ ]),
+ dir('bar', [
+ file('pubspec.yaml', '{name: bar, version: 2.0.4}'),
+ file('bar.dart', 'main() => print("bar 2.0.4");')
+ ])
+ ]).scheduleValidate();
run();
});
test('resolves version constraints from a pub server', () {
servePackages("localhost", 3123, [
- package("foo", "1.2.3", [dependency("baz", ">=2.0.0")]),
- package("bar", "2.3.4", [dependency("baz", "<3.0.0")]),
- package("baz", "2.0.3"),
- package("baz", "2.0.4"),
- package("baz", "3.0.1")
+ '''
+name: foo
+version: 1.2.3
+dependencies:
+ baz:
+ repo: {name: baz, url: http://localhost:3123}
+ version: ">=2.0.0"
+''',
+ '''
+name: bar
+version: 2.3.4
+dependencies:
+ baz:
+ repo: {name: baz, url: http://localhost:3123}
+ version: "<3.0.0"
+''',
+ '{name: baz, version: 2.0.3}',
+ '{name: baz, version: 2.0.4}',
+ '{name: baz, version: 3.0.1}',
]);
- appDir([dependency("foo"), dependency("bar")]).scheduleCreate();
+ 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!\$"));
- cacheDir({
- "foo": "1.2.3",
- "bar": "2.3.4",
- "baz": "2.0.4"
- }).scheduleValidate();
+ dir(cachePath, [
+ dir('repo', [
+ dir('localhost%583123', [
+ dir('foo-1.2.3', [
+ file('pubspec.yaml', '''
+name: foo
+version: 1.2.3
+dependencies:
+ baz:
+ repo: {name: baz, url: http://localhost:3123}
+ version: ">=2.0.0"
+'''),
+ file('foo.dart', 'main() => print("foo 1.2.3");')
+ ]),
+ dir('bar-2.3.4', [
+ file('pubspec.yaml', '''
+name: bar
+version: 2.3.4
+dependencies:
+ baz:
+ repo: {name: baz, url: http://localhost:3123}
+ version: "<3.0.0"
+'''),
+ file('bar.dart', 'main() => print("bar 2.3.4");')
+ ]),
+ dir('baz-2.0.4', [
+ file('pubspec.yaml', '{name: baz, version: 2.0.4}'),
+ file('baz.dart', 'main() => print("baz 2.0.4");')
+ ])
+ ])
+ ])
+ ]).scheduleValidate();
- packagesDir({
- "foo": "1.2.3",
- "bar": "2.3.4",
- "baz": "2.0.4"
- }).scheduleValidate();
+ dir(packagesPath, [
+ dir('foo', [
+ file('pubspec.yaml', '''
+name: foo
+version: 1.2.3
+dependencies:
+ baz:
+ repo: {name: baz, url: http://localhost:3123}
+ version: ">=2.0.0"
+'''),
+ file('foo.dart', 'main() => print("foo 1.2.3");')
+ ]),
+ dir('bar', [
+ file('pubspec.yaml', '''
+name: bar
+version: 2.3.4
+dependencies:
+ baz:
+ repo: {name: baz, url: http://localhost:3123}
+ version: "<3.0.0"
+'''),
+ file('bar.dart', 'main() => print("bar 2.3.4");')
+ ]),
+ dir('baz', [
+ file('pubspec.yaml', '{name: baz, version: 2.0.4}'),
+ file('baz.dart', 'main() => print("baz 2.0.4");')
+ ])
+ ]).scheduleValidate();
run();
});
@@ -365,7 +592,13 @@ installCommand() {
file('foo.dart', 'main() => "foo";')
]).scheduleCreate();
- appDir([{"git": "../foo.git"}]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ git: ../foo.git
+''')
+ ]).scheduleCreate();
// This install should lock the foo.git dependency to the current revision.
schedulePub(args: ['install'],
@@ -404,7 +637,13 @@ installCommand() {
file('foo.dart', 'main() => "foo";')
]).scheduleCreate();
- appDir([{"git": "../foo.git"}]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ git: ../foo.git
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
@@ -417,10 +656,17 @@ installCommand() {
git('foo.git', [
file('foo.dart', 'main() => "foo 1.0.0";'),
- libPubspec("foo", "1.0.0")
+ file('pubspec.yaml', 'version: 1.0.0')
]).scheduleCommit();
- appDir([{"git": "../foo.git", "version": ">=1.0.0"}]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ git: ../foo.git
+ version: ">=1.0.0"
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
@@ -440,10 +686,16 @@ installCommand() {
git('foo.git', [
file('foo.dart', 'main() => "foo 1.0.0";'),
- libPubspec("foo", "1.0.0")
+ file('pubspec.yaml', 'version: 1.0.0')
]).scheduleCreate();
- appDir([{"git": "../foo.git"}]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ git: ../foo.git
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
@@ -456,10 +708,17 @@ installCommand() {
git('foo.git', [
file('foo.dart', 'main() => "foo 1.0.1";'),
- libPubspec("foo", "1.0.1")
+ file('pubspec.yaml', 'version: 1.0.1')
]).scheduleCommit();
- appDir([{"git": "../foo.git", "version": ">=1.0.0"}]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ git: ../foo.git
+ version: ">=1.0.0"
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
@@ -474,82 +733,138 @@ installCommand() {
});
test('keeps a pub server package locked to the version in the lockfile', () {
- servePackages("localhost", 3123, [package("foo", "1.0.0")]);
+ servePackages("localhost", 3123, ['{name: foo, version: 1.0.0}']);
- appDir([dependency("foo")]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ repo: {name: foo, url: http://localhost:3123}
+''')
+ ]).scheduleCreate();
// This install should lock the foo dependency to version 1.0.0.
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
- packagesDir({"foo": "1.0.0"}).scheduleValidate();
+ dir(packagesPath, [
+ dir('foo', [
+ file('foo.dart', 'main() => print("foo 1.0.0");')
+ ])
+ ]).scheduleValidate();
// Delete the packages path to simulate a new checkout of the application.
dir(packagesPath).scheduleDelete();
// Start serving a newer package as well.
servePackages("localhost", 3123, [
- package("foo", "1.0.0"),
- package("foo", "1.0.1")
+ '{name: foo, version: 1.0.0}',
+ '{name: foo, version: 1.0.1}'
]);
// This install shouldn't update the foo dependency due to the lockfile.
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
- packagesDir({"foo": "1.0.0"}).scheduleValidate();
+ dir(packagesPath, [
+ dir('foo', [
+ file('foo.dart', 'main() => print("foo 1.0.0");')
+ ])
+ ]).scheduleValidate();
run();
});
test('updates a locked pub server package with a new incompatible '
'constraint', () {
- servePackages("localhost", 3123, [package("foo", "1.0.0")]);
+ servePackages("localhost", 3123, ['{name: foo, version: 1.0.0}']);
- appDir([dependency("foo")]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ repo: {name: foo, url: http://localhost:3123}
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
- packagesDir({"foo": "1.0.0"}).scheduleValidate();
+ dir(packagesPath, [
+ dir('foo', [
+ file('foo.dart', 'main() => print("foo 1.0.0");')
+ ])
+ ]).scheduleValidate();
servePackages("localhost", 3123, [
- package("foo", "1.0.0"),
- package("foo", "1.0.1")
+ '{name: foo, version: 1.0.0}',
+ '{name: foo, version: 1.0.1}'
]);
- appDir([dependency("foo", ">1.0.0")]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ repo: {name: foo, url: http://localhost:3123}
+ version: ">1.0.0"
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
- packagesDir({"foo": "1.0.1"}).scheduleValidate();
+ dir(packagesPath, [
+ dir('foo', [
+ file('foo.dart', 'main() => print("foo 1.0.1");')
+ ])
+ ]).scheduleValidate();
run();
});
test("doesn't update a locked pub server package with a new compatible "
"constraint", () {
- servePackages("localhost", 3123, [package("foo", "1.0.0")]);
+ servePackages("localhost", 3123, ['{name: foo, version: 1.0.0}']);
- appDir([dependency("foo")]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ repo: {name: foo, url: http://localhost:3123}
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
- packagesDir({"foo": "1.0.0"}).scheduleValidate();
+ dir(packagesPath, [
+ dir('foo', [
+ file('foo.dart', 'main() => print("foo 1.0.0");')
+ ])
+ ]).scheduleValidate();
servePackages("localhost", 3123, [
- package("foo", "1.0.0"),
- package("foo", "1.0.1")
+ '{name: foo, version: 1.0.0}',
+ '{name: foo, version: 1.0.1}'
]);
- appDir([dependency("foo", ">=1.0.0")]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ repo: {name: foo, url: http://localhost:3123}
+ version: ">=1.0.0"
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
- packagesDir({"foo": "1.0.0"}).scheduleValidate();
+ dir(packagesPath, [
+ dir('foo', [
+ file('foo.dart', 'main() => print("foo 1.0.0");')
+ ])
+ ]).scheduleValidate();
run();
});
@@ -557,52 +872,157 @@ installCommand() {
test("unlocks dependencies if necessary to ensure that a new dependency "
"is satisfied", () {
servePackages("localhost", 3123, [
- package("foo", "1.0.0", [dependency("bar", "<2.0.0")]),
- package("bar", "1.0.0", [dependency("baz", "<2.0.0")]),
- package("baz", "1.0.0", [dependency("qux", "<2.0.0")]),
- package("qux", "1.0.0")
- ]);
+ '''
+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
+dependencies:
+ qux:
+ version: "<2.0.0"
+ repo: {name: qux, url: http://localhost:3123}
+''',
+ '''
+name: qux
+version: 1.0.0
+''']);
- appDir([dependency("foo")]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ repo: {name: foo, url: http://localhost:3123}
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
- packagesDir({
- "foo": "1.0.0",
- "bar": "1.0.0",
- "baz": "1.0.0",
- "qux": "1.0.0"
- }).scheduleValidate();
+ 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");')
+ ]),
+ dir('qux', [
+ file('qux.dart', 'main() => print("qux 1.0.0");')
+ ])
+ ]).scheduleValidate();
servePackages("localhost", 3123, [
- package("foo", "1.0.0", [dependency("bar", "<2.0.0")]),
- package("foo", "2.0.0", [dependency("bar", "<3.0.0")]),
-
- package("bar", "1.0.0", [dependency("baz", "<2.0.0")]),
- package("bar", "2.0.0", [dependency("baz", "<3.0.0")]),
-
- package("baz", "1.0.0", [dependency("qux", "<2.0.0")]),
- package("baz", "2.0.0", [dependency("qux", "<3.0.0")]),
+ '''
+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
+dependencies:
+ qux:
+ version: "<2.0.0"
+ repo: {name: qux, url: http://localhost:3123}
+''',
+ '''
+name: baz
+version: 2.0.0
+dependencies:
+ qux:
+ version: "<3.0.0"
+ repo: {name: qux, url: http://localhost:3123}
+''',
+ '''
+name: qux
+version: 1.0.0
+''',
+ '''
+name: qux
+version: 2.0.0
+''',
+ '''
+name: newdep
+version: 2.0.0
+dependencies:
+ baz:
+ version: ">=1.5.0"
+ repo: {name: baz, url: http://localhost:3123}
+''']);
- package("qux", "1.0.0"),
- package("qux", "2.0.0"),
-
- package("newdep", "2.0.0", [dependency("baz", ">=1.5.0")])
- ]);
-
- appDir([dependency("foo"), dependency("newdep")]).scheduleCreate();
+ 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!$"));
- packagesDir({
- "foo": "2.0.0",
- "bar": "2.0.0",
- "baz": "2.0.0",
- "qux": "1.0.0",
- "newdep": "2.0.0"
- }).scheduleValidate();
+ dir(packagesPath, [
+ dir('foo', [
+ file('foo.dart', 'main() => print("foo 2.0.0");')
+ ]),
+ dir('bar', [
+ file('bar.dart', 'main() => print("bar 2.0.0");')
+ ]),
+ dir('baz', [
+ file('baz.dart', 'main() => print("baz 2.0.0");')
+ ]),
+ dir('qux', [
+ file('qux.dart', 'main() => print("qux 1.0.0");')
+ ]),
+ dir('newdep', [
+ file('newdep.dart', 'main() => print("newdep 2.0.0");')
+ ])
+ ]).scheduleValidate();
run();
});
@@ -610,46 +1030,127 @@ installCommand() {
test("doesn't unlock dependencies if a new dependency is already "
"satisfied", () {
servePackages("localhost", 3123, [
- package("foo", "1.0.0", [dependency("bar", "<2.0.0")]),
- package("bar", "1.0.0", [dependency("baz", "<2.0.0")]),
- package("baz", "1.0.0")
- ]);
+ '''
+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
+''']);
- appDir([dependency("foo")]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ repo: {name: foo, url: http://localhost:3123}
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
- packagesDir({
- "foo": "1.0.0",
- "bar": "1.0.0",
- "baz": "1.0.0"
- }).scheduleValidate();
+ 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, [
- package("foo", "1.0.0", [dependency("bar", "<2.0.0")]),
- package("foo", "2.0.0", [dependency("bar", "<3.0.0")]),
-
- package("bar", "1.0.0", [dependency("baz", "<2.0.0")]),
- package("bar", "2.0.0", [dependency("baz", "<3.0.0")]),
+ '''
+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.0.0"
+ repo: {name: baz, url: http://localhost:3123}
+''']);
- package("baz", "1.0.0"),
- package("baz", "2.0.0"),
-
- package("newdep", "2.0.0", [dependency("baz", ">=1.0.0")])
- ]);
-
- appDir([dependency("foo"), dependency("newdep")]).scheduleCreate();
+ 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!$"));
- packagesDir({
- "foo": "1.0.0",
- "bar": "1.0.0",
- "baz": "1.0.0",
- "newdep": "2.0.0"
- }).scheduleValidate();
+ 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");')
+ ]),
+ dir('newdep', [
+ file('newdep.dart', 'main() => print("newdep 2.0.0");')
+ ])
+ ]).scheduleValidate();
run();
});
@@ -667,7 +1168,15 @@ updateCommand() {
file('bar.dart', 'main() => "bar";')
]).scheduleCreate();
- appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ git: ../foo.git
+ bar:
+ git: ../bar.git
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
@@ -716,7 +1225,15 @@ updateCommand() {
file('bar.dart', 'main() => "bar";')
]).scheduleCreate();
- appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ git: ../foo.git
+ bar:
+ git: ../bar.git
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
@@ -759,14 +1276,24 @@ updateCommand() {
git('foo.git', [
file('foo.dart', 'main() => "foo";'),
- libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}])
+ file('pubspec.yaml', '''
+dependencies:
+ foo-dep:
+ git: ../foo-dep.git
+''')
]).scheduleCreate();
git('foo-dep.git', [
- file('foo-dep.dart', 'main() => "foo-dep";'),
+ file('foo-dep.dart', 'main() => "foo-dep";')
]).scheduleCreate();
- appDir([{"git": "../foo.git"}]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ git: ../foo.git
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
@@ -774,7 +1301,11 @@ updateCommand() {
dir(packagesPath, [
dir('foo', [
file('foo.dart', 'main() => "foo";'),
- libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}])
+ file('pubspec.yaml', '''
+dependencies:
+ foo-dep:
+ git: ../foo-dep.git
+''')
]),
dir('foo-dep', [
file('foo-dep.dart', 'main() => "foo-dep";')
@@ -783,7 +1314,11 @@ updateCommand() {
git('foo.git', [
file('foo.dart', 'main() => "foo 2";'),
- libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}])
+ file('pubspec.yaml', '''
+dependencies:
+ foo-dep:
+ git: ../foo-dep.git
+''')
]).scheduleCreate();
git('foo-dep.git', [
@@ -796,7 +1331,11 @@ updateCommand() {
dir(packagesPath, [
dir('foo', [
file('foo.dart', 'main() => "foo 2";'),
- libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}])
+ file('pubspec.yaml', '''
+dependencies:
+ foo-dep:
+ git: ../foo-dep.git
+''')
]),
dir('foo-dep', [
file('foo-dep.dart', 'main() => "foo-dep";')
@@ -809,32 +1348,80 @@ updateCommand() {
test("updates one locked pub server package's dependencies if it's "
"necessary", () {
servePackages("localhost", 3123, [
- package("foo", "1.0.0", [dependency("foo-dep")]),
- package("foo-dep", "1.0.0")
+ '''
+name: foo
+version: 1.0.0
+dependencies:
+ foo-dep:
+ repo:
+ name: foo-dep
+ url: http://localhost:3123
+''',
+ '{name: foo-dep, version: 1.0.0}'
]);
- appDir([dependency("foo")]).scheduleCreate();
+ dir(appPath, [
+ file('pubspec.yaml', '''
+dependencies:
+ foo:
+ repo:
+ name: foo
+ url: http://localhost:3123
+''')
+ ]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
- packagesDir({
- "foo": "1.0.0",
- "foo-dep": "1.0.0"
- }).scheduleValidate();
+ dir(packagesPath, [
+ dir('foo', [
+ file('foo.dart', 'main() => print("foo 1.0.0");'),
+ file('pubspec.yaml', '''
+name: foo
+version: 1.0.0
+dependencies:
+ foo-dep:
+ repo:
+ name: foo-dep
+ url: http://localhost:3123
+''')
+ ]),
+ dir('foo-dep', [
+ file('foo-dep.dart', 'main() => print("foo-dep 1.0.0");')
+ ])
+ ]).scheduleValidate();
servePackages("localhost", 3123, [
- package("foo", "2.0.0", [dependency("foo-dep", ">1.0.0")]),
- package("foo-dep", "2.0.0")
+ '''
+name: foo
+version: 2.0.0
+dependencies:
+ foo-dep:
+ repo: {name: foo-dep, url: http://localhost:3123}
+ version: ">1.0.0"
+''',
+ '{name: foo-dep, version: 2.0.0}'
]);
schedulePub(args: ['update', 'foo'],
output: const RegExp(@"Dependencies updated!$"));
- packagesDir({
- "foo": "2.0.0",
- "foo-dep": "2.0.0"
- }).scheduleValidate();
+ dir(packagesPath, [
+ dir('foo', [
+ file('foo.dart', 'main() => print("foo 2.0.0");'),
+ file('pubspec.yaml', '''
+name: foo
+version: 2.0.0
+dependencies:
+ foo-dep:
+ repo: {name: foo-dep, url: http://localhost:3123}
+ version: ">1.0.0"
+''')
+ ]),
+ dir('foo-dep', [
+ file('foo-dep.dart', 'main() => print("foo-dep 2.0.0");')
+ ])
+ ]).scheduleValidate();
run();
});
@@ -842,35 +1429,71 @@ updateCommand() {
test("updates a locked package's dependers in order to get it to max "
"version", () {
servePackages("localhost", 3123, [
- package("foo", "1.0.0", [dependency("bar", "<2.0.0")]),
- package("bar", "1.0.0")
+ '''
+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}'
]);
- appDir([dependency("foo"), dependency("bar")]).scheduleCreate();
+ 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!$"));
- packagesDir({
- "foo": "1.0.0",
- "bar": "1.0.0"
- }).scheduleValidate();
+ 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, [
- package("foo", "1.0.0", [dependency("bar", "<2.0.0")]),
- package("foo", "2.0.0", [dependency("bar", "<3.0.0")]),
-
- package("bar", "1.0.0"),
- package("bar", "2.0.0")
+ '''
+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!$"));
- packagesDir({
- "foo": "2.0.0",
- "bar": "2.0.0"
- }).scheduleValidate();
+ 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();
});
« 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