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

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

Issue 356523003: Add implicit constraints from pub onto stack_trace and source_maps. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 6 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 | « sdk/lib/_internal/pub/test/implicit_barback_dependency_test.dart ('k') | 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/implicit_dependency_test.dart
diff --git a/sdk/lib/_internal/pub/test/implicit_dependency_test.dart b/sdk/lib/_internal/pub/test/implicit_dependency_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..2f18b34c0ba76bd510b1e4319d15a13018a942ba
--- /dev/null
+++ b/sdk/lib/_internal/pub/test/implicit_dependency_test.dart
@@ -0,0 +1,126 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:scheduled_test/scheduled_test.dart';
+
+import 'descriptor.dart' as d;
+import 'test_pub.dart';
+import '../lib/src/barback.dart' as barback;
+import '../lib/src/version.dart';
+
+main() {
+ initConfig();
+
+ forBothPubGetAndUpgrade((command) {
+ integration("implicitly constrains it to versions pub supports", () {
+ servePackages([
+ packageMap("barback", current("barback")),
+ packageMap("stack_trace", previous("stack_trace")),
+ packageMap("stack_trace", current("stack_trace")),
+ packageMap("stack_trace", nextPatch("stack_trace")),
+ packageMap("stack_trace", max("stack_trace")),
+ packageMap("source_maps", current("source_maps"))
+ ]);
+
+ d.appDir({
+ "barback": "any"
+ }).create();
+
+ pubCommand(command);
+
+ d.packagesDir({"stack_trace": nextPatch("stack_trace")}).validate();
+ });
+
+ integration("pub's implicit constraint uses the same source and "
+ "description as a dependency override", () {
+ servePackages([
+ packageMap("barback", current("barback")),
+ packageMap("stack_trace", nextPatch("stack_trace")),
+ packageMap("source_maps", current("source_maps"))
+ ]);
+
+ d.dir("stack_trace", [
+ d.libDir("stack_trace", 'stack_trace ${current("stack_trace")}'),
+ d.libPubspec("stack_trace", current("stack_trace"))
+ ]).create();
+
+ d.dir(appPath, [
+ d.pubspec({
+ "name": "myapp",
+ "dependencies": {"barback": "any"},
+ "dependency_overrides": {
+ "stack_trace": {"path": "../stack_trace"},
+ }
+ })
+ ]).create();
+
+ pubCommand(command);
+
+ // Validate that we're using the path dependency version of stack_trace
+ // rather than the hosted version.
+ d.packagesDir({
+ "stack_trace": current("stack_trace")
+ }).validate();
+ });
+
+ integration("doesn't add a constraint if barback isn't in the package "
+ "graph", () {
+ servePackages([
+ packageMap("stack_trace", previous("stack_trace")),
+ packageMap("stack_trace", current("stack_trace")),
+ packageMap("stack_trace", nextPatch("stack_trace")),
+ packageMap("stack_trace", max("stack_trace")),
+ packageMap("source_maps", current("source_maps"))
+ ]);
+
+ d.appDir({
+ "stack_trace": "any"
+ }).create();
+
+ pubCommand(command);
+
+ d.packagesDir({"stack_trace": max("stack_trace")}).validate();
+ });
+ });
+
+ integration("unlocks if the locked version doesn't meet pub's "
+ "constraint", () {
+ servePackages([
+ packageMap("barback", current("barback")),
+ packageMap("stack_trace", previous("stack_trace")),
+ packageMap("stack_trace", current("stack_trace")),
+ packageMap("source_maps", current("source_maps"))
+ ]);
+
+ d.appDir({"barback": "any"}).create();
+
+ // Hand-create a lockfile to pin the package to an older version.
+ createLockFile("myapp", hosted: {
+ "barback": current("barback"),
+ "stack_trace": previous("stack_trace")
+ });
+
+ pubGet();
+
+ // It should be upgraded.
+ d.packagesDir({
+ "stack_trace": current("stack_trace")
+ }).validate();
+ });
+}
+
+String current(String packageName) =>
+ barback.pubConstraints[packageName].min.toString();
+
+String previous(String packageName) {
+ var constraint = barback.pubConstraints[packageName];
+ return new Version(constraint.min.major, constraint.min.minor - 1, 0)
+ .toString();
+}
+
+String nextPatch(String packageName) =>
+ barback.pubConstraints[packageName].min.nextPatch.toString();
+
+String max(String packageName) =>
+ barback.pubConstraints[packageName].max.toString();
« no previous file with comments | « sdk/lib/_internal/pub/test/implicit_barback_dependency_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698