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

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

Issue 10695132: Reverting 9527 (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/utils.dart ('k') | no next file » | 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 file('pubspec.yaml', ''' 161 file('pubspec.yaml', '''
162 dependencies: 162 dependencies:
163 foo: 163 foo:
164 git: ../foo.git 164 git: ../foo.git
165 ''') 165 ''')
166 ]).scheduleCreate(); 166 ]).scheduleCreate();
167 167
168 schedulePub(args: ['install'], 168 schedulePub(args: ['install'],
169 output: const RegExp(@"Dependencies installed!$")); 169 output: const RegExp(@"Dependencies installed!$"));
170 170
171 dir(cachePath, [
172 dir('git', [
173 dir('cache', [
174 dir(new RegExp(@'foo-[a-f0-9]+'), [
175 file('foo.dart', 'main() => "foo";')
176 ])
177 ]),
178 dir(new RegExp(@'foo-[a-f0-9]+'), [
179 file('foo.dart', 'main() => "foo";')
180 ])
181 ])
182 ]).scheduleValidate();
183
184 dir(packagesPath, [ 171 dir(packagesPath, [
185 dir('foo', [ 172 dir('foo', [
186 file('foo.dart', 'main() => "foo";') 173 file('foo.dart', 'main() => "foo";')
187 ]) 174 ])
188 ]).scheduleValidate(); 175 ]).scheduleValidate();
189 176
190 run(); 177 run();
191 }); 178 });
192 }); 179 });
193 180
(...skipping 16 matching lines...) Expand all
210 file('pubspec.yaml', ''' 197 file('pubspec.yaml', '''
211 dependencies: 198 dependencies:
212 foo: 199 foo:
213 git: ../foo.git 200 git: ../foo.git
214 ''') 201 ''')
215 ]).scheduleCreate(); 202 ]).scheduleCreate();
216 203
217 schedulePub(args: ['install'], 204 schedulePub(args: ['install'],
218 output: const RegExp("Dependencies installed!\$")); 205 output: const RegExp("Dependencies installed!\$"));
219 206
220 dir(cachePath, [
221 dir('git', [
222 dir('cache', [
223 dir(new RegExp(@'foo-[a-f0-9]+'), [
224 file('foo.dart', 'main() => "foo";')
225 ]),
226 dir(new RegExp(@'bar-[a-f0-9]+'), [
227 file('bar.dart', 'main() => "bar";')
228 ])
229 ]),
230 dir(new RegExp(@'foo-[a-f0-9]+'), [
231 file('foo.dart', 'main() => "foo";')
232 ]),
233 dir(new RegExp(@'bar-[a-f0-9]+'), [
234 file('bar.dart', 'main() => "bar";')
235 ])
236 ])
237 ]).scheduleValidate();
238
239 dir(packagesPath, [ 207 dir(packagesPath, [
240 dir('foo', [ 208 dir('foo', [
241 file('foo.dart', 'main() => "foo";') 209 file('foo.dart', 'main() => "foo";')
242 ]), 210 ]),
243 dir('bar', [ 211 dir('bar', [
244 file('bar.dart', 'main() => "bar";') 212 file('bar.dart', 'main() => "bar";')
245 ]) 213 ])
246 ]).scheduleValidate(); 214 ]).scheduleValidate();
247 215
248 run(); 216 run();
249 }); 217 });
250 }); 218 });
251 219
252 test('checks out and updates a package from Git', () {
253 withGit(() {
254 git('foo.git', [
255 file('foo.dart', 'main() => "foo";')
256 ]).scheduleCreate();
257
258 dir(appPath, [
259 file('pubspec.yaml', '''
260 dependencies:
261 foo:
262 git: ../foo.git
263 ''')
264 ]).scheduleCreate();
265
266 schedulePub(args: ['install'],
267 output: const RegExp(@"Dependencies installed!$"));
268
269 dir(cachePath, [
270 dir('git', [
271 dir('cache', [
272 dir(new RegExp(@'foo-[a-f0-9]+'), [
273 file('foo.dart', 'main() => "foo";')
274 ])
275 ]),
276 dir(new RegExp(@'foo-[a-f0-9]+'), [
277 file('foo.dart', 'main() => "foo";')
278 ])
279 ])
280 ]).scheduleValidate();
281
282 dir(packagesPath, [
283 dir('foo', [
284 file('foo.dart', 'main() => "foo";')
285 ])
286 ]).scheduleValidate();
287
288 // TODO(nweiz): remove this once we support pub update
289 dir(packagesPath).scheduleDelete();
290
291 git('foo.git', [
292 file('foo.dart', 'main() => "foo 2";')
293 ]).scheduleCommit();
294
295 schedulePub(args: ['install'],
296 output: const RegExp(@"Dependencies installed!$"));
297
298 // When we download a new version of the git package, we should re-use the
299 // git/cache directory but create a new git/ directory.
300 dir(cachePath, [
301 dir('git', [
302 dir('cache', [
303 dir(new RegExp(@'foo-[a-f0-9]+'), [
304 file('foo.dart', 'main() => "foo 2";')
305 ])
306 ]),
307 dir(new RegExp(@'foo-[a-f0-9]+'), [
308 file('foo.dart', 'main() => "foo";')
309 ]),
310 dir(new RegExp(@'foo-[a-f0-9]+'), [
311 file('foo.dart', 'main() => "foo 2";')
312 ])
313 ])
314 ]).scheduleValidate();
315
316 dir(packagesPath, [
317 dir('foo', [
318 file('foo.dart', 'main() => "foo 2";')
319 ])
320 ]).scheduleValidate();
321
322 run();
323 });
324 });
325
326 test('checks out a package from Git twice', () {
327 withGit(() {
328 git('foo.git', [
329 file('foo.dart', 'main() => "foo";')
330 ]).scheduleCreate();
331
332 dir(appPath, [
333 file('pubspec.yaml', '''
334 dependencies:
335 foo:
336 git: ../foo.git
337 ''')
338 ]).scheduleCreate();
339
340 schedulePub(args: ['install'],
341 output: const RegExp(@"Dependencies installed!$"));
342
343 dir(cachePath, [
344 dir('git', [
345 dir('cache', [
346 dir(new RegExp(@'foo-[a-f0-9]+'), [
347 file('foo.dart', 'main() => "foo";')
348 ])
349 ]),
350 dir(new RegExp(@'foo-[a-f0-9]+'), [
351 file('foo.dart', 'main() => "foo";')
352 ])
353 ])
354 ]).scheduleValidate();
355
356 dir(packagesPath, [
357 dir('foo', [
358 file('foo.dart', 'main() => "foo";')
359 ])
360 ]).scheduleValidate();
361
362 // TODO(nweiz): remove this once we support pub update
363 dir(packagesPath).scheduleDelete();
364
365 // Verify that nothing breaks if we install a Git revision that's already
366 // in the cache.
367 schedulePub(args: ['install'],
368 output: const RegExp(@"Dependencies installed!$"));
369
370 run();
371 });
372 });
373
374 test('checks out a package from a pub server', () { 220 test('checks out a package from a pub server', () {
375 servePackages("localhost", 3123, ['{name: foo, version: 1.2.3}']); 221 servePackages("localhost", 3123, ['{name: foo, version: 1.2.3}']);
376 222
377 dir(appPath, [ 223 dir(appPath, [
378 file('pubspec.yaml', ''' 224 file('pubspec.yaml', '''
379 dependencies: 225 dependencies:
380 foo: 226 foo:
381 repo: 227 repo:
382 name: foo 228 name: foo
383 url: http://localhost:3123 229 url: http://localhost:3123
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 ]).scheduleValidate(); 325 ]).scheduleValidate();
480 326
481 run(); 327 run();
482 }); 328 });
483 } 329 }
484 330
485 versionCommand() { 331 versionCommand() {
486 test('displays the current version', () => 332 test('displays the current version', () =>
487 runPub(args: ['version'], output: VERSION_STRING)); 333 runPub(args: ['version'], output: VERSION_STRING));
488 } 334 }
OLDNEW
« no previous file with comments | « utils/pub/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698