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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/pub/test/implicit_barback_dependency_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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:scheduled_test/scheduled_test.dart';
6
7 import 'descriptor.dart' as d;
8 import 'test_pub.dart';
9 import '../lib/src/barback.dart' as barback;
10 import '../lib/src/version.dart';
11
12 main() {
13 initConfig();
14
15 forBothPubGetAndUpgrade((command) {
16 integration("implicitly constrains it to versions pub supports", () {
17 servePackages([
18 packageMap("barback", current("barback")),
19 packageMap("stack_trace", previous("stack_trace")),
20 packageMap("stack_trace", current("stack_trace")),
21 packageMap("stack_trace", nextPatch("stack_trace")),
22 packageMap("stack_trace", max("stack_trace")),
23 packageMap("source_maps", current("source_maps"))
24 ]);
25
26 d.appDir({
27 "barback": "any"
28 }).create();
29
30 pubCommand(command);
31
32 d.packagesDir({"stack_trace": nextPatch("stack_trace")}).validate();
33 });
34
35 integration("pub's implicit constraint uses the same source and "
36 "description as a dependency override", () {
37 servePackages([
38 packageMap("barback", current("barback")),
39 packageMap("stack_trace", nextPatch("stack_trace")),
40 packageMap("source_maps", current("source_maps"))
41 ]);
42
43 d.dir("stack_trace", [
44 d.libDir("stack_trace", 'stack_trace ${current("stack_trace")}'),
45 d.libPubspec("stack_trace", current("stack_trace"))
46 ]).create();
47
48 d.dir(appPath, [
49 d.pubspec({
50 "name": "myapp",
51 "dependencies": {"barback": "any"},
52 "dependency_overrides": {
53 "stack_trace": {"path": "../stack_trace"},
54 }
55 })
56 ]).create();
57
58 pubCommand(command);
59
60 // Validate that we're using the path dependency version of stack_trace
61 // rather than the hosted version.
62 d.packagesDir({
63 "stack_trace": current("stack_trace")
64 }).validate();
65 });
66
67 integration("doesn't add a constraint if barback isn't in the package "
68 "graph", () {
69 servePackages([
70 packageMap("stack_trace", previous("stack_trace")),
71 packageMap("stack_trace", current("stack_trace")),
72 packageMap("stack_trace", nextPatch("stack_trace")),
73 packageMap("stack_trace", max("stack_trace")),
74 packageMap("source_maps", current("source_maps"))
75 ]);
76
77 d.appDir({
78 "stack_trace": "any"
79 }).create();
80
81 pubCommand(command);
82
83 d.packagesDir({"stack_trace": max("stack_trace")}).validate();
84 });
85 });
86
87 integration("unlocks if the locked version doesn't meet pub's "
88 "constraint", () {
89 servePackages([
90 packageMap("barback", current("barback")),
91 packageMap("stack_trace", previous("stack_trace")),
92 packageMap("stack_trace", current("stack_trace")),
93 packageMap("source_maps", current("source_maps"))
94 ]);
95
96 d.appDir({"barback": "any"}).create();
97
98 // Hand-create a lockfile to pin the package to an older version.
99 createLockFile("myapp", hosted: {
100 "barback": current("barback"),
101 "stack_trace": previous("stack_trace")
102 });
103
104 pubGet();
105
106 // It should be upgraded.
107 d.packagesDir({
108 "stack_trace": current("stack_trace")
109 }).validate();
110 });
111 }
112
113 String current(String packageName) =>
114 barback.pubConstraints[packageName].min.toString();
115
116 String previous(String packageName) {
117 var constraint = barback.pubConstraints[packageName];
118 return new Version(constraint.min.major, constraint.min.minor - 1, 0)
119 .toString();
120 }
121
122 String nextPatch(String packageName) =>
123 barback.pubConstraints[packageName].min.nextPatch.toString();
124
125 String max(String packageName) =>
126 barback.pubConstraints[packageName].max.toString();
OLDNEW
« 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