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

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

Issue 10913077: Use a bare git repository for the repo cache. (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
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');
11 11
12 main() { 12 main() {
13 test('checks out a package from Git', () { 13 test('checks out a package from Git', () {
14 ensureGit(); 14 ensureGit();
15 15
16 git('foo.git', [ 16 git('foo.git', [
17 file('foo.dart', 'main() => "foo";') 17 file('foo.dart', 'main() => "foo";')
18 ]).scheduleCreate(); 18 ]).scheduleCreate();
19 19
20 appDir([{"git": "../foo.git"}]).scheduleCreate(); 20 appDir([{"git": "../foo.git"}]).scheduleCreate();
21 21
22 schedulePub(args: ['install'], 22 schedulePub(args: ['install'],
23 output: const RegExp(@"Dependencies installed!$")); 23 output: const RegExp(@"Dependencies installed!$"));
24 24
25 dir(cachePath, [ 25 dir(cachePath, [
26 dir('git', [ 26 dir('git', [
27 dir('cache', [gitPackageCacheDir('foo')]), 27 dir('cache', [gitPackageRepoCacheDir('foo')]),
28 gitPackageCacheDir('foo') 28 gitPackageRevisionCacheDir('foo')
29 ]) 29 ])
30 ]).scheduleValidate(); 30 ]).scheduleValidate();
31 31
32 dir(packagesPath, [ 32 dir(packagesPath, [
33 dir('foo', [ 33 dir('foo', [
34 file('foo.dart', 'main() => "foo";') 34 file('foo.dart', 'main() => "foo";')
35 ]) 35 ])
36 ]).scheduleValidate(); 36 ]).scheduleValidate();
37 37
38 run(); 38 run();
(...skipping 12 matching lines...) Expand all
51 ]).scheduleCreate(); 51 ]).scheduleCreate();
52 52
53 appDir([{"git": "../foo.git"}]).scheduleCreate(); 53 appDir([{"git": "../foo.git"}]).scheduleCreate();
54 54
55 schedulePub(args: ['install'], 55 schedulePub(args: ['install'],
56 output: const RegExp("Dependencies installed!\$")); 56 output: const RegExp("Dependencies installed!\$"));
57 57
58 dir(cachePath, [ 58 dir(cachePath, [
59 dir('git', [ 59 dir('git', [
60 dir('cache', [ 60 dir('cache', [
61 gitPackageCacheDir('foo'), 61 gitPackageRepoCacheDir('foo'),
62 gitPackageCacheDir('bar') 62 gitPackageRepoCacheDir('bar')
63 ]), 63 ]),
64 gitPackageCacheDir('foo'), 64 gitPackageRevisionCacheDir('foo'),
65 gitPackageCacheDir('bar') 65 gitPackageRevisionCacheDir('bar')
66 ]) 66 ])
67 ]).scheduleValidate(); 67 ]).scheduleValidate();
68 68
69 dir(packagesPath, [ 69 dir(packagesPath, [
70 dir('foo', [ 70 dir('foo', [
71 file('foo.dart', 'main() => "foo";') 71 file('foo.dart', 'main() => "foo";')
72 ]), 72 ]),
73 dir('bar', [ 73 dir('bar', [
74 file('bar.dart', 'main() => "bar";') 74 file('bar.dart', 'main() => "bar";')
75 ]) 75 ])
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 file('foo.dart', 'main() => "foo";') 111 file('foo.dart', 'main() => "foo";')
112 ]).scheduleCreate(); 112 ]).scheduleCreate();
113 113
114 appDir([{"git": "../foo.git"}]).scheduleCreate(); 114 appDir([{"git": "../foo.git"}]).scheduleCreate();
115 115
116 schedulePub(args: ['install'], 116 schedulePub(args: ['install'],
117 output: const RegExp(@"Dependencies installed!$")); 117 output: const RegExp(@"Dependencies installed!$"));
118 118
119 dir(cachePath, [ 119 dir(cachePath, [
120 dir('git', [ 120 dir('git', [
121 dir('cache', [gitPackageCacheDir('foo')]), 121 dir('cache', [gitPackageRepoCacheDir('foo')]),
122 gitPackageCacheDir('foo') 122 gitPackageRevisionCacheDir('foo')
123 ]) 123 ])
124 ]).scheduleValidate(); 124 ]).scheduleValidate();
125 125
126 dir(packagesPath, [ 126 dir(packagesPath, [
127 dir('foo', [ 127 dir('foo', [
128 file('foo.dart', 'main() => "foo";') 128 file('foo.dart', 'main() => "foo";')
129 ]) 129 ])
130 ]).scheduleValidate(); 130 ]).scheduleValidate();
131 131
132 // TODO(nweiz): remove this once we support pub update 132 // TODO(nweiz): remove this once we support pub update
133 dir(packagesPath).scheduleDelete(); 133 dir(packagesPath).scheduleDelete();
134 file('$appPath/pubspec.lock', '').scheduleDelete(); 134 file('$appPath/pubspec.lock', '').scheduleDelete();
135 135
136 git('foo.git', [ 136 git('foo.git', [
137 file('foo.dart', 'main() => "foo 2";') 137 file('foo.dart', 'main() => "foo 2";')
138 ]).scheduleCommit(); 138 ]).scheduleCommit();
139 139
140 schedulePub(args: ['install'], 140 schedulePub(args: ['install'],
141 output: const RegExp(@"Dependencies installed!$")); 141 output: const RegExp(@"Dependencies installed!$"));
142 142
143 // When we download a new version of the git package, we should re-use the 143 // When we download a new version of the git package, we should re-use the
144 // git/cache directory but create a new git/ directory. 144 // git/cache directory but create a new git/ directory.
145 dir(cachePath, [ 145 dir(cachePath, [
146 dir('git', [ 146 dir('git', [
147 dir('cache', [gitPackageCacheDir('foo', 2)]), 147 dir('cache', [gitPackageRepoCacheDir('foo')]),
148 gitPackageCacheDir('foo'), 148 gitPackageRevisionCacheDir('foo'),
149 gitPackageCacheDir('foo', 2) 149 gitPackageRevisionCacheDir('foo', 2)
150 ]) 150 ])
151 ]).scheduleValidate(); 151 ]).scheduleValidate();
152 152
153 dir(packagesPath, [ 153 dir(packagesPath, [
154 dir('foo', [ 154 dir('foo', [
155 file('foo.dart', 'main() => "foo 2";') 155 file('foo.dart', 'main() => "foo 2";')
156 ]) 156 ])
157 ]).scheduleValidate(); 157 ]).scheduleValidate();
158 158
159 run(); 159 run();
160 }); 160 });
161 161
162 test('checks out a package from Git twice', () { 162 test('checks out a package from Git twice', () {
163 ensureGit(); 163 ensureGit();
164 164
165 git('foo.git', [ 165 git('foo.git', [
166 file('foo.dart', 'main() => "foo";') 166 file('foo.dart', 'main() => "foo";')
167 ]).scheduleCreate(); 167 ]).scheduleCreate();
168 168
169 appDir([{"git": "../foo.git"}]).scheduleCreate(); 169 appDir([{"git": "../foo.git"}]).scheduleCreate();
170 170
171 schedulePub(args: ['install'], 171 schedulePub(args: ['install'],
172 output: const RegExp(@"Dependencies installed!$")); 172 output: const RegExp(@"Dependencies installed!$"));
173 173
174 dir(cachePath, [ 174 dir(cachePath, [
175 dir('git', [ 175 dir('git', [
176 dir('cache', [gitPackageCacheDir('foo')]), 176 dir('cache', [gitPackageRepoCacheDir('foo')]),
177 gitPackageCacheDir('foo') 177 gitPackageRevisionCacheDir('foo')
178 ]) 178 ])
179 ]).scheduleValidate(); 179 ]).scheduleValidate();
180 180
181 dir(packagesPath, [ 181 dir(packagesPath, [
182 dir('foo', [ 182 dir('foo', [
183 file('foo.dart', 'main() => "foo";') 183 file('foo.dart', 'main() => "foo";')
184 ]) 184 ])
185 ]).scheduleValidate(); 185 ]).scheduleValidate();
186 186
187 // TODO(nweiz): remove this once we support pub update 187 // TODO(nweiz): remove this once we support pub update
(...skipping 27 matching lines...) Expand all
215 215
216 dir(packagesPath, [ 216 dir(packagesPath, [
217 dir('foo', [ 217 dir('foo', [
218 file('foo.dart', 'main() => "foo 1";') 218 file('foo.dart', 'main() => "foo 1";')
219 ]) 219 ])
220 ]).scheduleValidate(); 220 ]).scheduleValidate();
221 221
222 run(); 222 run();
223 }); 223 });
224 224
225 test('checks out a package at a specific branch from Git', () {
226 ensureGit();
227
228 var repo = git('foo.git', [
229 file('foo.dart', 'main() => "foo 1";')
230 ]);
231 repo.scheduleCreate();
232 repo.scheduleGit(["branch", "old"]);
233
234 git('foo.git', [
235 file('foo.dart', 'main() => "foo 2";')
236 ]).scheduleCommit();
237
238 appDir([{"git": {"url": "../foo.git", "ref": "old"}}]).scheduleCreate();
239
240 schedulePub(args: ['install'],
241 output: const RegExp(@"Dependencies installed!$"));
242
243 dir(packagesPath, [
244 dir('foo', [
245 file('foo.dart', 'main() => "foo 1";')
246 ])
247 ]).scheduleValidate();
248
249 run();
250 });
251
225 test('keeps a Git package locked to the version in the lockfile', () { 252 test('keeps a Git package locked to the version in the lockfile', () {
226 ensureGit(); 253 ensureGit();
227 254
228 git('foo.git', [ 255 git('foo.git', [
229 file('foo.dart', 'main() => "foo";') 256 file('foo.dart', 'main() => "foo";')
230 ]).scheduleCreate(); 257 ]).scheduleCreate();
231 258
232 appDir([{"git": "../foo.git"}]).scheduleCreate(); 259 appDir([{"git": "../foo.git"}]).scheduleCreate();
233 260
234 // This install should lock the foo.git dependency to the current revision. 261 // This install should lock the foo.git dependency to the current revision.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 file('foo.dart', 'main() => "foo";') 372 file('foo.dart', 'main() => "foo";')
346 ]).scheduleCreate(); 373 ]).scheduleCreate();
347 374
348 appDir([{"git": "../foo.git/"}]).scheduleCreate(); 375 appDir([{"git": "../foo.git/"}]).scheduleCreate();
349 376
350 schedulePub(args: ['install'], 377 schedulePub(args: ['install'],
351 output: const RegExp(@"Dependencies installed!$")); 378 output: const RegExp(@"Dependencies installed!$"));
352 379
353 dir(cachePath, [ 380 dir(cachePath, [
354 dir('git', [ 381 dir('git', [
355 dir('cache', [gitPackageCacheDir('foo')]), 382 dir('cache', [gitPackageRepoCacheDir('foo')]),
356 gitPackageCacheDir('foo') 383 gitPackageRevisionCacheDir('foo')
357 ]) 384 ])
358 ]).scheduleValidate(); 385 ]).scheduleValidate();
359 386
360 dir(packagesPath, [ 387 dir(packagesPath, [
361 dir('foo', [ 388 dir('foo', [
362 file('foo.dart', 'main() => "foo";') 389 file('foo.dart', 'main() => "foo";')
363 ]) 390 ])
364 ]).scheduleValidate(); 391 ]).scheduleValidate();
365 392
366 run(); 393 run();
367 }); 394 });
368 }); 395 });
369 } 396 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698