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

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

Issue 10736015: Make the Git source install to the system cache. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor fixes 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 side-by-side diff with in-line comments
Download patch
« utils/pub/git_source.dart ('K') | « utils/pub/utils.dart ('k') | no next file » | 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 93a594513b1133545beafaa6c049825ed38d43d7..8d7f1cdc94c72acdf81965ba187c3ffaf064bf0d 100644
--- a/utils/tests/pub/pub_test.dart
+++ b/utils/tests/pub/pub_test.dart
@@ -168,6 +168,19 @@ dependencies:
schedulePub(args: ['install'],
output: const RegExp(@"Dependencies installed!$"));
+ dir(cachePath, [
+ dir('git', [
+ 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();
+
dir(packagesPath, [
dir('foo', [
file('foo.dart', 'main() => "foo";')
@@ -204,6 +217,25 @@ dependencies:
schedulePub(args: ['install'],
output: const RegExp("Dependencies installed!\$"));
+ dir(cachePath, [
+ dir('git', [
+ dir('cache', [
+ dir(new RegExp(@'foo-[a-f0-9]+'), [
+ file('foo.dart', 'main() => "foo";')
+ ]),
+ dir(new RegExp(@'bar-[a-f0-9]+'), [
+ file('bar.dart', 'main() => "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();
+
dir(packagesPath, [
dir('foo', [
file('foo.dart', 'main() => "foo";')
@@ -217,6 +249,128 @@ dependencies:
});
});
+ test('checks out and updates a package from Git', () {
+ withGit(() {
+ git('foo.git', [
+ file('foo.dart', 'main() => "foo";')
+ ]).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', [
+ 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();
+
+ dir(packagesPath, [
+ dir('foo', [
+ file('foo.dart', 'main() => "foo";')
+ ])
+ ]).scheduleValidate();
+
+ // TODO(nweiz): remove this once we support pub update
+ dir(packagesPath).scheduleDelete();
+
+ git('foo.git', [
+ file('foo.dart', 'main() => "foo 2";')
+ ]).scheduleCommit();
+
+ schedulePub(args: ['install'],
+ output: const RegExp(@"Dependencies installed!$"));
+
+ // When we download a new version of the git package, we should re-use the
+ // git/cache directory but create a new git/ directory.
+ dir(cachePath, [
+ dir('git', [
+ 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();
+
+ dir(packagesPath, [
+ dir('foo', [
+ file('foo.dart', 'main() => "foo 2";')
+ ])
+ ]).scheduleValidate();
+
+ run();
+ });
+ });
+
+ test('checks out a package from Git twice', () {
+ withGit(() {
+ git('foo.git', [
+ file('foo.dart', 'main() => "foo";')
+ ]).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', [
+ 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();
+
+ dir(packagesPath, [
+ dir('foo', [
+ file('foo.dart', 'main() => "foo";')
+ ])
+ ]).scheduleValidate();
+
+ // TODO(nweiz): remove this once we support pub update
+ dir(packagesPath).scheduleDelete();
+
+ // Verify that nothing breaks if we install a Git revision that's already
+ // in the cache.
+ schedulePub(args: ['install'],
+ output: const RegExp(@"Dependencies installed!$"));
+
+ run();
+ });
+ });
+
test('checks out a package from a pub server', () {
servePackages("localhost", 3123, ['{name: foo, version: 1.2.3}']);
« utils/pub/git_source.dart ('K') | « utils/pub/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698