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

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

Issue 115533003: Show implicit pub dependency on barback in errors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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
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 import 'descriptor.dart' as d; 5 import 'descriptor.dart' as d;
6 import 'test_pub.dart'; 6 import 'test_pub.dart';
7 import '../lib/src/barback.dart' as barback; 7 import '../lib/src/barback.dart' as barback;
8 import '../lib/src/version.dart'; 8 import '../lib/src/version.dart';
9 9
10 main() { 10 main() {
11 initConfig(); 11 initConfig();
12 12
13 var previousVersion = new Version( 13 var current = barback.supportedVersion.toString();
14 barback.supportedVersion.major, barback.supportedVersion.minor - 1, 0); 14 var previous = new Version(barback.supportedVersion.major,
15 barback.supportedVersion.minor - 1, 0).toString();
16 var nextPatch = barback.supportedVersion.nextPatch.toString();
17 var max = barback.supportedVersion.nextMinor.toString();
15 18
16 forBothPubGetAndUpgrade((command) { 19 forBothPubGetAndUpgrade((command) {
17 integration("implicitly constrains barback to versions pub supports", () { 20 integration("implicitly constrains barback to versions pub supports", () {
18 servePackages([ 21 servePackages([
19 packageMap("barback", previousVersion.toString()), 22 packageMap("barback", previous),
20 packageMap("barback", barback.supportedVersion.toString()), 23 packageMap("barback", current),
21 packageMap("barback", barback.supportedVersion.nextPatch.toString()), 24 packageMap("barback", nextPatch),
22 packageMap("barback", barback.supportedVersion.nextMinor.toString()) 25 packageMap("barback", max)
23 ]); 26 ]);
24 27
25 d.appDir({ 28 d.appDir({
26 "barback": "any" 29 "barback": "any"
27 }).create(); 30 }).create();
28 31
29 pubCommand(command); 32 pubCommand(command);
30 33
31 d.packagesDir({ 34 d.packagesDir({
32 "barback": barback.supportedVersion.nextPatch.toString() 35 "barback": barback.supportedVersion.nextPatch.toString()
33 }).validate(); 36 }).validate();
34 }); 37 });
35 38
36 integration("discovers transitive dependency on barback", () { 39 integration("discovers transitive dependency on barback", () {
37 servePackages([ 40 servePackages([
38 packageMap("barback", previousVersion.toString()), 41 packageMap("barback", previous),
39 packageMap("barback", barback.supportedVersion.toString()), 42 packageMap("barback", current),
40 packageMap("barback", barback.supportedVersion.nextPatch.toString()), 43 packageMap("barback", nextPatch),
41 packageMap("barback", barback.supportedVersion.nextMinor.toString()) 44 packageMap("barback", max)
42 ]); 45 ]);
43 46
44 d.dir("foo", [ 47 d.dir("foo", [
45 d.libDir("foo", "foo 0.0.1"), 48 d.libDir("foo", "foo 0.0.1"),
46 d.libPubspec("foo", "0.0.1", deps: { 49 d.libPubspec("foo", "0.0.1", deps: {
47 "barback": "any" 50 "barback": "any"
48 }) 51 })
49 ]).create(); 52 ]).create();
50 53
51 d.appDir({ 54 d.appDir({
52 "foo": {"path": "../foo"} 55 "foo": {"path": "../foo"}
53 }).create(); 56 }).create();
54 57
55 pubCommand(command); 58 pubCommand(command);
56 59
57 d.packagesDir({ 60 d.packagesDir({
58 "barback": barback.supportedVersion.nextPatch.toString(), 61 "barback": nextPatch,
59 "foo": "0.0.1" 62 "foo": "0.0.1"
60 }).validate(); 63 }).validate();
61 }); 64 });
65
66 integration("pub's implicit constraint uses the same source and "
67 "description as the explicit one", () {
68 d.dir('barback', [
69 d.libDir('barback', 'barback $current'),
70 d.libPubspec('barback', current)
71 ]).create();
72
73 d.dir(appPath, [
74 d.appPubspec({
75 "barback": {"path": "../barback"}
76 })
77 ]).create();
78
79 pubCommand(command);
80
81 d.packagesDir({
82 "barback": current
83 }).validate();
84 });
nweiz 2013/12/13 23:15:21 Also test that installation fails if the barback b
62 }); 85 });
63 86
64 integration("unlock if the locked version doesn't meet pub's constraint", () { 87 integration("unlock if the locked version doesn't meet pub's constraint", () {
65 servePackages([ 88 servePackages([
66 packageMap("barback", previousVersion.toString()), 89 packageMap("barback", previous),
67 packageMap("barback", barback.supportedVersion.toString()) 90 packageMap("barback", current)
68 ]); 91 ]);
69 92
70 d.appDir({"barback": "any"}).create(); 93 d.appDir({"barback": "any"}).create();
71 94
72 // Hand-create a lockfile to pin barback to an older version. 95 // Hand-create a lockfile to pin barback to an older version.
73 createLockFile("myapp", hosted: { 96 createLockFile("myapp", hosted: {
74 "barback": previousVersion.toString() 97 "barback": previous
75 }); 98 });
76 99
77 pubGet(); 100 pubGet();
78 101
79 // It should be upgraded. 102 // It should be upgraded.
80 d.packagesDir({ 103 d.packagesDir({
81 "barback": barback.supportedVersion.toString() 104 "barback": current
82 }).validate(); 105 }).validate();
83 }); 106 });
107
108 integration("include pub in the error if a solve failed because there "
nweiz 2013/12/13 23:15:21 "include" -> "includes"
Bob Nystrom 2013/12/14 00:07:35 Done.
109 "is no version available", () {
110 servePackages([
111 packageMap("barback", previous)
112 ]);
113
114 d.appDir({"barback": "any"}).create();
115
116 pubGet(error: """
117 Package 'barback' has no versions that match >=$current <$max derived from:
118 - 'myapp' depends on version any
119 - 'pub' depends on version >=$current <$max""");
120 });
121
122 integration("include pub in the error if a solve failed because there "
123 "is a disjoint constraint", () {
124 servePackages([
125 packageMap("barback", current)
126 ]);
127
128 d.appDir({"barback": previous}).create();
129
130 pubGet(error: """
131 Incompatible version constraints on 'myapp':
132 - 'myapp' depends on version $previous
133 - 'pub' depends on version >=$current <$max""");
134 });
84 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698