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

Side by Side Diff: sdk/lib/_internal/pub/test/test_pub.dart

Issue 34803006: Make pubspec.lock keep relative path if it is originally specified as relative in pubspec.yaml (iss… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Improve code according to the code review comments Created 7 years, 1 month 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 | « sdk/lib/_internal/pub/test/lock_file_test.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) 2013, 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
(...skipping 14 matching lines...) Expand all
25 // TODO(rnystrom): Using "gitlib" as the prefix here is ugly, but "git" collides 25 // TODO(rnystrom): Using "gitlib" as the prefix here is ugly, but "git" collides
26 // with the git descriptor method. Maybe we should try to clean up the top level 26 // with the git descriptor method. Maybe we should try to clean up the top level
27 // scope a bit? 27 // scope a bit?
28 import '../lib/src/git.dart' as gitlib; 28 import '../lib/src/git.dart' as gitlib;
29 import '../lib/src/http.dart'; 29 import '../lib/src/http.dart';
30 import '../lib/src/io.dart'; 30 import '../lib/src/io.dart';
31 import '../lib/src/lock_file.dart'; 31 import '../lib/src/lock_file.dart';
32 import '../lib/src/log.dart' as log; 32 import '../lib/src/log.dart' as log;
33 import '../lib/src/package.dart'; 33 import '../lib/src/package.dart';
34 import '../lib/src/safe_http_server.dart'; 34 import '../lib/src/safe_http_server.dart';
35 import '../lib/src/source/path.dart';
36 import '../lib/src/source_registry.dart';
35 import '../lib/src/system_cache.dart'; 37 import '../lib/src/system_cache.dart';
36 import '../lib/src/utils.dart'; 38 import '../lib/src/utils.dart';
37 import '../lib/src/validator.dart'; 39 import '../lib/src/validator.dart';
38 import '../lib/src/version.dart'; 40 import '../lib/src/version.dart';
39 import 'descriptor.dart' as d; 41 import 'descriptor.dart' as d;
40 42
41 /// This should be called at the top of a test file to set up an appropriate 43 /// This should be called at the top of a test file to set up an appropriate
42 /// test configuration for the machine running the tests. 44 /// test configuration for the machine running the tests.
43 initConfig() { 45 initConfig() {
44 useCompactVMConfiguration(); 46 useCompactVMConfiguration();
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 } 648 }
647 649
648 var lockFile = new LockFile.empty(); 650 var lockFile = new LockFile.empty();
649 dependencies.forEach((name, dependencyPath) { 651 dependencies.forEach((name, dependencyPath) {
650 var id = new PackageId(name, 'path', new Version(0, 0, 0), { 652 var id = new PackageId(name, 'path', new Version(0, 0, 0), {
651 'path': dependencyPath, 653 'path': dependencyPath,
652 'relative': path.isRelative(dependencyPath) 654 'relative': path.isRelative(dependencyPath)
653 }); 655 });
654 lockFile.packages[name] = id; 656 lockFile.packages[name] = id;
655 }); 657 });
656 d.file(path.join(package, 'pubspec.lock'), lockFile.serialize()).create(); 658
659 var sources = new SourceRegistry()
660 ..register(new PathSource());
661
662 d.file(path.join(package, 'pubspec.lock'),
663 lockFile.serialize(null, sources)).create();
657 } 664 }
658 665
659 /// Use [client] as the mock HTTP client for this test. 666 /// Use [client] as the mock HTTP client for this test.
660 /// 667 ///
661 /// Note that this will only affect HTTP requests made via http.dart in the 668 /// Note that this will only affect HTTP requests made via http.dart in the
662 /// parent process. 669 /// parent process.
663 void useMockClient(MockClient client) { 670 void useMockClient(MockClient client) {
664 var oldInnerClient = httpClient.inner; 671 var oldInnerClient = httpClient.inner;
665 httpClient.inner = client; 672 httpClient.inner = client;
666 currentSchedule.onComplete.schedule(() { 673 currentSchedule.onComplete.schedule(() {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 bool matches(item, Map matchState) { 848 bool matches(item, Map matchState) {
842 if (item is! Pair) return false; 849 if (item is! Pair) return false;
843 return _firstMatcher.matches(item.first, matchState) && 850 return _firstMatcher.matches(item.first, matchState) &&
844 _lastMatcher.matches(item.last, matchState); 851 _lastMatcher.matches(item.last, matchState);
845 } 852 }
846 853
847 Description describe(Description description) { 854 Description describe(Description description) {
848 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); 855 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]);
849 } 856 }
850 } 857 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/test/lock_file_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698