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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/implicit_dependency_test.dart

Issue 657673002: Regenerate pub sources. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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
OLDNEW
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
1 import 'package:pub_semver/pub_semver.dart'; 5 import 'package:pub_semver/pub_semver.dart';
6
2 import 'descriptor.dart' as d; 7 import 'descriptor.dart' as d;
3 import 'test_pub.dart'; 8 import 'test_pub.dart';
4 import '../lib/src/barback.dart' as barback; 9 import '../lib/src/barback.dart' as barback;
10
5 main() { 11 main() {
6 initConfig(); 12 initConfig();
13
7 forBothPubGetAndUpgrade((command) { 14 forBothPubGetAndUpgrade((command) {
8 integration("implicitly constrains it to versions pub supports", () { 15 integration("implicitly constrains it to versions pub supports", () {
9 servePackages((builder) { 16 servePackages((builder) {
10 builder.serve("barback", current("barback")); 17 builder.serve("barback", current("barback"));
11 builder.serve("stack_trace", previous("stack_trace")); 18 builder.serve("stack_trace", previous("stack_trace"));
12 builder.serve("stack_trace", current("stack_trace")); 19 builder.serve("stack_trace", current("stack_trace"));
13 builder.serve("stack_trace", nextPatch("stack_trace")); 20 builder.serve("stack_trace", nextPatch("stack_trace"));
14 builder.serve("stack_trace", max("stack_trace")); 21 builder.serve("stack_trace", max("stack_trace"));
15 builder.serve("source_span", current("source_span")); 22 builder.serve("source_span", current("source_span"));
16 }); 23 });
24
17 d.appDir({ 25 d.appDir({
18 "barback": "any" 26 "barback": "any"
19 }).create(); 27 }).create();
28
20 pubCommand(command); 29 pubCommand(command);
30
21 d.packagesDir({ 31 d.packagesDir({
22 "stack_trace": nextPatch("stack_trace") 32 "stack_trace": nextPatch("stack_trace")
23 }).validate(); 33 }).validate();
24 }); 34 });
35
25 integration( 36 integration(
26 "pub's implicit constraint uses the same source and " 37 "pub's implicit constraint uses the same source and "
27 "description as a dependency override", 38 "description as a dependency override",
28 () { 39 () {
29 servePackages((builder) { 40 servePackages((builder) {
30 builder.serve("barback", current("barback")); 41 builder.serve("barback", current("barback"));
31 builder.serve("stack_trace", nextPatch("stack_trace")); 42 builder.serve("stack_trace", nextPatch("stack_trace"));
32 builder.serve("source_span", current("source_span")); 43 builder.serve("source_span", current("source_span"));
33 }); 44 });
45
34 d.dir( 46 d.dir(
35 "stack_trace", 47 "stack_trace",
36 [ 48 [
37 d.libDir("stack_trace", 'stack_trace ${current("stack_trace")}'), 49 d.libDir("stack_trace", 'stack_trace ${current("stack_trace")}'),
38 d.libPubspec("stack_trace", current("stack_trace"))]).create(); 50 d.libPubspec("stack_trace", current("stack_trace"))]).create();
51
39 d.dir(appPath, [d.pubspec({ 52 d.dir(appPath, [d.pubspec({
40 "name": "myapp", 53 "name": "myapp",
41 "dependencies": { 54 "dependencies": {
42 "barback": "any" 55 "barback": "any"
43 }, 56 },
44 "dependency_overrides": { 57 "dependency_overrides": {
45 "stack_trace": { 58 "stack_trace": {
46 "path": "../stack_trace" 59 "path": "../stack_trace"
47 } 60 },
48 } 61 }
49 })]).create(); 62 })]).create();
63
50 pubCommand(command); 64 pubCommand(command);
65
66 // Validate that we're using the path dependency version of stack_trace
67 // rather than the hosted version.
51 d.packagesDir({ 68 d.packagesDir({
52 "stack_trace": current("stack_trace") 69 "stack_trace": current("stack_trace")
53 }).validate(); 70 }).validate();
54 }); 71 });
72
55 integration( 73 integration(
56 "doesn't add a constraint if barback isn't in the package " "graph", 74 "doesn't add a constraint if barback isn't in the package " "graph",
57 () { 75 () {
58 servePackages((builder) { 76 servePackages((builder) {
59 builder.serve("stack_trace", previous("stack_trace")); 77 builder.serve("stack_trace", previous("stack_trace"));
60 builder.serve("stack_trace", current("stack_trace")); 78 builder.serve("stack_trace", current("stack_trace"));
61 builder.serve("stack_trace", nextPatch("stack_trace")); 79 builder.serve("stack_trace", nextPatch("stack_trace"));
62 builder.serve("stack_trace", max("stack_trace")); 80 builder.serve("stack_trace", max("stack_trace"));
63 builder.serve("source_span", current("source_span")); 81 builder.serve("source_span", current("source_span"));
64 }); 82 });
83
65 d.appDir({ 84 d.appDir({
66 "stack_trace": "any" 85 "stack_trace": "any"
67 }).create(); 86 }).create();
87
68 pubCommand(command); 88 pubCommand(command);
89
69 d.packagesDir({ 90 d.packagesDir({
70 "stack_trace": max("stack_trace") 91 "stack_trace": max("stack_trace")
71 }).validate(); 92 }).validate();
72 }); 93 });
73 }); 94 });
95
74 integration( 96 integration(
75 "unlocks if the locked version doesn't meet pub's " "constraint", 97 "unlocks if the locked version doesn't meet pub's " "constraint",
76 () { 98 () {
77 servePackages((builder) { 99 servePackages((builder) {
78 builder.serve("barback", current("barback")); 100 builder.serve("barback", current("barback"));
79 builder.serve("stack_trace", previous("stack_trace")); 101 builder.serve("stack_trace", previous("stack_trace"));
80 builder.serve("stack_trace", current("stack_trace")); 102 builder.serve("stack_trace", current("stack_trace"));
81 builder.serve("source_span", current("source_span")); 103 builder.serve("source_span", current("source_span"));
82 }); 104 });
105
83 d.appDir({ 106 d.appDir({
84 "barback": "any" 107 "barback": "any"
85 }).create(); 108 }).create();
109
110 // Hand-create a lockfile to pin the package to an older version.
86 createLockFile("myapp", hosted: { 111 createLockFile("myapp", hosted: {
87 "barback": current("barback"), 112 "barback": current("barback"),
88 "stack_trace": previous("stack_trace") 113 "stack_trace": previous("stack_trace")
89 }); 114 });
115
90 pubGet(); 116 pubGet();
117
118 // It should be upgraded.
91 d.packagesDir({ 119 d.packagesDir({
92 "stack_trace": current("stack_trace") 120 "stack_trace": current("stack_trace")
93 }).validate(); 121 }).validate();
94 }); 122 });
95 } 123 }
124
96 String current(String packageName) => 125 String current(String packageName) =>
97 barback.pubConstraints[packageName].min.toString(); 126 barback.pubConstraints[packageName].min.toString();
127
98 String previous(String packageName) { 128 String previous(String packageName) {
99 var constraint = barback.pubConstraints[packageName]; 129 var constraint = barback.pubConstraints[packageName];
100 return new Version( 130 return new Version(
101 constraint.min.major, 131 constraint.min.major,
102 constraint.min.minor - 1, 132 constraint.min.minor - 1,
103 0).toString(); 133 0).toString();
104 } 134 }
135
105 String nextPatch(String packageName) => 136 String nextPatch(String packageName) =>
106 barback.pubConstraints[packageName].min.nextPatch.toString(); 137 barback.pubConstraints[packageName].min.nextPatch.toString();
138
107 String max(String packageName) => 139 String max(String packageName) =>
108 barback.pubConstraints[packageName].max.toString(); 140 barback.pubConstraints[packageName].max.toString();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698