OLD | NEW |
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:collection' show Queue; | 12 import 'dart:collection' show Queue; |
13 import 'dart:io'; | 13 import 'dart:io'; |
14 import 'dart:json' as json; | 14 import 'dart:json' as json; |
15 import 'dart:math'; | 15 import 'dart:math'; |
16 import 'dart:uri'; | 16 import 'dart:uri'; |
17 | 17 |
18 import '../../../pkg/oauth2/lib/oauth2.dart' as oauth2; | 18 import '../../../pkg/oauth2/lib/oauth2.dart' as oauth2; |
19 import '../../../pkg/path/lib/path.dart' as path; | 19 import '../../../pkg/path/lib/path.dart' as path; |
20 import '../../../pkg/unittest/lib/unittest.dart'; | 20 import '../../../pkg/unittest/lib/unittest.dart'; |
21 import '../../../pkg/http/lib/testing.dart'; | 21 import '../../../pkg/http/lib/testing.dart'; |
22 import '../../lib/file_system.dart' as fs; | 22 import '../../lib/file_system.dart' as fs; |
23 import '../../pub/entrypoint.dart'; | 23 import '../../pub/entrypoint.dart'; |
24 import '../../pub/git_source.dart'; | 24 import '../../pub/git_source.dart'; |
25 import '../../pub/hosted_source.dart'; | 25 import '../../pub/hosted_source.dart'; |
| 26 import '../../pub/path_source.dart'; |
26 import '../../pub/http.dart'; | 27 import '../../pub/http.dart'; |
27 import '../../pub/io.dart'; | 28 import '../../pub/io.dart'; |
28 import '../../pub/sdk_source.dart'; | 29 import '../../pub/sdk_source.dart'; |
29 import '../../pub/system_cache.dart'; | 30 import '../../pub/system_cache.dart'; |
30 import '../../pub/utils.dart'; | 31 import '../../pub/utils.dart'; |
31 import '../../pub/validator.dart'; | 32 import '../../pub/validator.dart'; |
32 import '../../pub/yaml/yaml.dart'; | 33 import '../../pub/yaml/yaml.dart'; |
33 import 'command_line_config.dart'; | 34 import 'command_line_config.dart'; |
34 | 35 |
35 /// This should be called at the top of a test file to set up an appropriate | 36 /// This should be called at the top of a test file to set up an appropriate |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 switch (sourceName) { | 383 switch (sourceName) { |
383 case "git": | 384 case "git": |
384 source = new GitSource(); | 385 source = new GitSource(); |
385 break; | 386 break; |
386 case "hosted": | 387 case "hosted": |
387 source = new HostedSource(); | 388 source = new HostedSource(); |
388 break; | 389 break; |
389 case "sdk": | 390 case "sdk": |
390 source = new SdkSource(); | 391 source = new SdkSource(); |
391 break; | 392 break; |
| 393 case "path": |
| 394 source = new PathSource(); |
| 395 break; |
392 default: | 396 default: |
393 throw 'Unknown source "$sourceName"'; | 397 throw 'Unknown source "$sourceName"'; |
394 } | 398 } |
395 | 399 |
396 result[_packageName(sourceName, dependency[sourceName])] = dependency; | 400 result[_packageName(sourceName, dependency[sourceName])] = dependency; |
397 } | 401 } |
398 return result; | 402 return result; |
399 }); | 403 }); |
400 } | 404 } |
401 | 405 |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1557 /// calling [completion] is unnecessary. | 1561 /// calling [completion] is unnecessary. |
1558 void expectLater(Future actual, matcher, {String reason, | 1562 void expectLater(Future actual, matcher, {String reason, |
1559 FailureHandler failureHandler, bool verbose: false}) { | 1563 FailureHandler failureHandler, bool verbose: false}) { |
1560 _schedule((_) { | 1564 _schedule((_) { |
1561 return actual.then((value) { | 1565 return actual.then((value) { |
1562 expect(value, matcher, reason: reason, failureHandler: failureHandler, | 1566 expect(value, matcher, reason: reason, failureHandler: failureHandler, |
1563 verbose: false); | 1567 verbose: false); |
1564 }); | 1568 }); |
1565 }); | 1569 }); |
1566 } | 1570 } |
OLD | NEW |