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

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

Issue 11931040: adds file path source to pub (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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) 2013, 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 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub 5 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub
6 /// tests are integration tests that stage some stuff on the file system, run 6 /// tests are integration tests that stage some stuff on the file system, run
7 /// pub, and then validate the results. This library provides an API to build 7 /// pub, and then validate the results. This library provides an API to build
8 /// tests like that. 8 /// tests like that.
9 library test_pub; 9 library test_pub;
10 10
11 import 'dart:async'; 11 import 'dart:async';
12 import 'dart:io'; 12 import 'dart:io';
13 import 'dart:json' as json; 13 import 'dart:json' as json;
14 import 'dart:math'; 14 import 'dart:math';
15 import 'dart:uri'; 15 import 'dart:uri';
16 16
17 import '../../../pkg/oauth2/lib/oauth2.dart' as oauth2; 17 import '../../../pkg/oauth2/lib/oauth2.dart' as oauth2;
18 import '../../../pkg/path/lib/path.dart' as path; 18 import '../../../pkg/path/lib/path.dart' as path;
19 import '../../../pkg/unittest/lib/unittest.dart'; 19 import '../../../pkg/unittest/lib/unittest.dart';
20 import '../../../pkg/http/lib/testing.dart'; 20 import '../../../pkg/http/lib/testing.dart';
21 import '../../lib/file_system.dart' as fs; 21 import '../../lib/file_system.dart' as fs;
22 import '../../pub/entrypoint.dart'; 22 import '../../pub/entrypoint.dart';
23 import '../../pub/git_source.dart'; 23 import '../../pub/git_source.dart';
24 import '../../pub/hosted_source.dart'; 24 import '../../pub/hosted_source.dart';
25 import '../../pub/path_source.dart';
25 import '../../pub/http.dart'; 26 import '../../pub/http.dart';
26 import '../../pub/io.dart'; 27 import '../../pub/io.dart';
27 import '../../pub/sdk_source.dart'; 28 import '../../pub/sdk_source.dart';
28 import '../../pub/system_cache.dart'; 29 import '../../pub/system_cache.dart';
29 import '../../pub/utils.dart'; 30 import '../../pub/utils.dart';
30 import '../../pub/validator.dart'; 31 import '../../pub/validator.dart';
31 import '../../pub/yaml/yaml.dart'; 32 import '../../pub/yaml/yaml.dart';
32 33
33 /// Creates a new [FileDescriptor] with [name] and [contents]. 34 /// Creates a new [FileDescriptor] with [name] and [contents].
34 FileDescriptor file(Pattern name, String contents) => 35 FileDescriptor file(Pattern name, String contents) =>
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 switch (sourceName) { 372 switch (sourceName) {
372 case "git": 373 case "git":
373 source = new GitSource(); 374 source = new GitSource();
374 break; 375 break;
375 case "hosted": 376 case "hosted":
376 source = new HostedSource(); 377 source = new HostedSource();
377 break; 378 break;
378 case "sdk": 379 case "sdk":
379 source = new SdkSource(''); 380 source = new SdkSource('');
380 break; 381 break;
382 case "path":
383 source = new PathSource();
384 break;
381 default: 385 default:
382 throw 'Unknown source "$sourceName"'; 386 throw 'Unknown source "$sourceName"';
383 } 387 }
384 388
385 result[_packageName(sourceName, dependency[sourceName])] = dependency; 389 result[_packageName(sourceName, dependency[sourceName])] = dependency;
386 } 390 }
387 return result; 391 return result;
388 }); 392 });
389 } 393 }
390 394
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 /// calling [completion] is unnecessary. 1543 /// calling [completion] is unnecessary.
1540 void expectLater(Future actual, matcher, {String reason, 1544 void expectLater(Future actual, matcher, {String reason,
1541 FailureHandler failureHandler, bool verbose: false}) { 1545 FailureHandler failureHandler, bool verbose: false}) {
1542 _schedule((_) { 1546 _schedule((_) {
1543 return actual.then((value) { 1547 return actual.then((value) {
1544 expect(value, matcher, reason: reason, failureHandler: failureHandler, 1548 expect(value, matcher, reason: reason, failureHandler: failureHandler,
1545 verbose: false); 1549 verbose: false);
1546 }); 1550 });
1547 }); 1551 });
1548 } 1552 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698