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

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

Issue 1165473002: Start pulling pub from its own repo. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Code review changes Created 5 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
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:pub_semver/pub_semver.dart';
6
7 import 'descriptor.dart' as d;
8 import 'test_pub.dart';
9 import '../lib/src/barback.dart' as barback;
10
11 main() {
12 initConfig();
13
14 var constraint = barback.pubConstraints["barback"];
15 var current = constraint.min.toString();
16 var previous = new Version(constraint.min.major, constraint.min.minor - 1, 0)
17 .toString();
18 var nextPatch = constraint.min.nextPatch.toString();
19 var max = constraint.max.toString();
20
21 var sourceSpanVersion = barback.pubConstraints["source_span"].min.toString();
22 var stackTraceVersion = barback.pubConstraints["stack_trace"].min.toString();
23
24 forBothPubGetAndUpgrade((command) {
25 integration("implicitly constrains barback to versions pub supports", () {
26 servePackages((builder) {
27 builder.serve("barback", previous);
28 builder.serve("barback", current);
29 builder.serve("barback", nextPatch);
30 builder.serve("barback", max);
31 builder.serve("source_span", sourceSpanVersion);
32 builder.serve("stack_trace", stackTraceVersion);
33 });
34
35 d.appDir({
36 "barback": "any"
37 }).create();
38
39 pubCommand(command);
40
41 d.packagesDir({
42 "barback": nextPatch
43 }).validate();
44 });
45
46 integration("discovers transitive dependency on barback", () {
47 servePackages((builder) {
48 builder.serve("barback", previous);
49 builder.serve("barback", current);
50 builder.serve("barback", nextPatch);
51 builder.serve("barback", max);
52 builder.serve("source_span", sourceSpanVersion);
53 builder.serve("stack_trace", stackTraceVersion);
54 });
55
56 d.dir("foo", [
57 d.libDir("foo", "foo 0.0.1"),
58 d.libPubspec("foo", "0.0.1", deps: {
59 "barback": "any"
60 })
61 ]).create();
62
63 d.appDir({
64 "foo": {"path": "../foo"}
65 }).create();
66
67 pubCommand(command);
68
69 d.packagesDir({
70 "barback": nextPatch,
71 "foo": "0.0.1"
72 }).validate();
73 });
74
75 integration("pub's implicit constraint uses the same source and "
76 "description as a dependency override", () {
77 servePackages((builder) {
78 builder.serve("source_span", sourceSpanVersion);
79 builder.serve("stack_trace", stackTraceVersion);
80 });
81
82 d.dir('barback', [
83 d.libDir('barback', 'barback $current'),
84 d.libPubspec('barback', current),
85 ]).create();
86
87 d.dir(appPath, [
88 d.pubspec({
89 "name": "myapp",
90 "dependency_overrides": {
91 "barback": {"path": "../barback"}
92 }
93 })
94 ]).create();
95
96 pubCommand(command);
97
98 d.packagesDir({
99 "barback": current
100 }).validate();
101 });
102 });
103
104 integration("unlock if the locked version doesn't meet pub's constraint", () {
105 servePackages((builder) {
106 builder.serve("barback", previous);
107 builder.serve("barback", current);
108 builder.serve("source_span", sourceSpanVersion);
109 builder.serve("stack_trace", stackTraceVersion);
110 });
111
112 d.appDir({"barback": "any"}).create();
113
114 // Hand-create a lockfile to pin barback to an older version.
115 createLockFile("myapp", hosted: {
116 "barback": previous
117 });
118
119 pubGet();
120
121 // It should be upgraded.
122 d.packagesDir({
123 "barback": current
124 }).validate();
125 });
126
127 integration("includes pub in the error if a solve failed because there "
128 "is no version available", () {
129 servePackages((builder) {
130 builder.serve("barback", previous);
131 builder.serve("source_span", sourceSpanVersion);
132 builder.serve("stack_trace", stackTraceVersion);
133 });
134
135 d.appDir({"barback": "any"}).create();
136
137 pubGet(error: """
138 Package barback has no versions that match >=$current <$max derived from:
139 - myapp depends on version any
140 - pub itself depends on version >=$current <$max""");
141 });
142
143 integration("includes pub in the error if a solve failed because there "
144 "is a disjoint constraint", () {
145 servePackages((builder) {
146 builder.serve("barback", previous);
147 builder.serve("barback", current);
148 builder.serve("source_span", sourceSpanVersion);
149 builder.serve("stack_trace", stackTraceVersion);
150 });
151
152 d.appDir({"barback": previous}).create();
153
154 pubGet(error: """
155 Incompatible version constraints on barback:
156 - myapp depends on version $previous
157 - pub itself depends on version >=$current <$max""");
158 });
159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698