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

Unified Diff: sdk/lib/_internal/pub/test/test_pub.dart

Issue 435843002: Test pub against older source_maps versions when using older barback versions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/test/test_pub.dart
diff --git a/sdk/lib/_internal/pub/test/test_pub.dart b/sdk/lib/_internal/pub/test/test_pub.dart
index 6729e0d3b25317894c82083966ac3de1b98351b3..5b499e340aec084550c6962a498bbc94bc8c5720 100644
--- a/sdk/lib/_internal/pub/test/test_pub.dart
+++ b/sdk/lib/_internal/pub/test/test_pub.dart
@@ -74,9 +74,12 @@ Matcher isMinifiedDart2JSOutput =
Matcher isUnminifiedDart2JSOutput =
contains("// The code supports the following hooks");
-/// The directory containing the version of barback that should be used for this
-/// test.
-String _barbackDir;
+/// A map from package names to paths from which those packages should be loaded
+/// for [createLockFile].
+///
+/// This allows older versions of dependencies than those that exist in the repo
+/// to be used when testing pub.
+Map<String, String> _packageOverrides;
/// A map from barback versions to the paths of directories in the repo
/// containing them.
@@ -85,6 +88,18 @@ String _barbackDir;
/// versions of barback in third_party.
final _barbackVersions = _findBarbackVersions();
+/// Some older barback versions require older versions of barback's dependencies
+/// than those that are in the repo.
+///
+/// This is a map from barback version ranges to the dependencies for those
+/// barback versions. Each dependency version listed here should be included in
+/// third_party/pkg.
+final _barbackDeps = {
+ new VersionConstraint.parse("<0.15.0"): {
+ "source_maps": "0.9.4"
+ }
+};
+
/// Populates [_barbackVersions].
Map<Version, String> _findBarbackVersions() {
var versions = {};
@@ -119,7 +134,19 @@ void withBarbackVersions(String versionConstraint, void callback()) {
for (var version in validVersions) {
group("with barback $version", () {
setUp(() {
- _barbackDir = _barbackVersions[version];
+ _packageOverrides = {};
+ _packageOverrides['barback'] = _barbackVersions[version];
+ _barbackDeps.forEach((constraint, deps) {
+ if (!constraint.allows(version)) return;
+ deps.forEach((packageName, version) {
+ _packageOverrides[packageName] = path.join(
+ repoRoot, 'third_party', 'pkg', '$packageName-$version');
+ });
+ });
+
+ currentSchedule.onComplete.schedule(() {
+ _packageOverrides = null;
+ });
});
callback();
@@ -789,13 +816,14 @@ Iterable<String> pkg, Map<String, String> hosted}) {
if (dependencies.containsKey(package)) return;
var packagePath;
- if (package == 'barback') {
- if (_barbackDir == null) {
- throw new StateError("createLockFile() can only create a lock file "
- "with a barback dependency within a withBarbackVersions() "
- "block.");
- }
- packagePath = _barbackDir;
+ if (package == 'barback' && _packageOverrides == null) {
+ throw new StateError("createLockFile() can only create a lock file "
+ "with a barback dependency within a withBarbackVersions() "
+ "block.");
+ }
+
+ if (_packageOverrides.containsKey(package)) {
+ packagePath = _packageOverrides[package];
} else {
packagePath = path.join(pkgPath, package);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698