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

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

Issue 557563002: Store the async-await compiled pub code directly in the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
5 import 'package:path/path.dart' as path; 1 import 'package:path/path.dart' as path;
6
7 import 'descriptor.dart' as d; 2 import 'descriptor.dart' as d;
8 import 'test_pub.dart'; 3 import 'test_pub.dart';
9
10 main() { 4 main() {
11 initConfig(); 5 initConfig();
12 forBothPubGetAndUpgrade((command) { 6 forBothPubGetAndUpgrade((command) {
13 integration("chooses best version matching override constraint", () { 7 integration("chooses best version matching override constraint", () {
14 servePackages((builder) { 8 servePackages((builder) {
15 builder.serve("foo", "1.0.0"); 9 builder.serve("foo", "1.0.0");
16 builder.serve("foo", "2.0.0"); 10 builder.serve("foo", "2.0.0");
17 builder.serve("foo", "3.0.0"); 11 builder.serve("foo", "3.0.0");
18 }); 12 });
19 13 d.dir(appPath, [d.pubspec({
20 d.dir(appPath, [
21 d.pubspec({
22 "name": "myapp", 14 "name": "myapp",
23 "dependencies": { 15 "dependencies": {
24 "foo": ">2.0.0" 16 "foo": ">2.0.0"
25 }, 17 },
26 "dependency_overrides": { 18 "dependency_overrides": {
27 "foo": "<3.0.0" 19 "foo": "<3.0.0"
28 } 20 }
29 }) 21 })]).create();
30 ]).create();
31
32 pubCommand(command); 22 pubCommand(command);
33
34 d.packagesDir({ 23 d.packagesDir({
35 "foo": "2.0.0" 24 "foo": "2.0.0"
36 }).validate(); 25 }).validate();
37 }); 26 });
38
39 integration("treats override as implicit dependency", () { 27 integration("treats override as implicit dependency", () {
40 servePackages((builder) { 28 servePackages((builder) {
41 builder.serve("foo", "1.0.0"); 29 builder.serve("foo", "1.0.0");
42 }); 30 });
43 31 d.dir(appPath, [d.pubspec({
44 d.dir(appPath, [
45 d.pubspec({
46 "name": "myapp", 32 "name": "myapp",
47 "dependency_overrides": { 33 "dependency_overrides": {
48 "foo": "any" 34 "foo": "any"
49 } 35 }
50 }) 36 })]).create();
51 ]).create();
52
53 pubCommand(command); 37 pubCommand(command);
54
55 d.packagesDir({ 38 d.packagesDir({
56 "foo": "1.0.0" 39 "foo": "1.0.0"
57 }).validate(); 40 }).validate();
58 }); 41 });
59
60 integration("ignores other constraints on overridden package", () { 42 integration("ignores other constraints on overridden package", () {
61 servePackages((builder) { 43 servePackages((builder) {
62 builder.serve("foo", "1.0.0"); 44 builder.serve("foo", "1.0.0");
63 builder.serve("foo", "2.0.0"); 45 builder.serve("foo", "2.0.0");
64 builder.serve("foo", "3.0.0"); 46 builder.serve("foo", "3.0.0");
65 builder.serve("bar", "1.0.0", pubspec: { 47 builder.serve("bar", "1.0.0", pubspec: {
66 "dependencies": {"foo": "5.0.0-nonexistent"} 48 "dependencies": {
49 "foo": "5.0.0-nonexistent"
50 }
67 }); 51 });
68 }); 52 });
69 53 d.dir(appPath, [d.pubspec({
70 d.dir(appPath, [
71 d.pubspec({
72 "name": "myapp", 54 "name": "myapp",
73 "dependencies": { 55 "dependencies": {
74 "bar": "any" 56 "bar": "any"
75 }, 57 },
76 "dependency_overrides": { 58 "dependency_overrides": {
77 "foo": "<3.0.0" 59 "foo": "<3.0.0"
78 } 60 }
79 }) 61 })]).create();
80 ]).create();
81
82 pubCommand(command); 62 pubCommand(command);
83
84 d.packagesDir({ 63 d.packagesDir({
85 "foo": "2.0.0", 64 "foo": "2.0.0",
86 "bar": "1.0.0" 65 "bar": "1.0.0"
87 }).validate(); 66 }).validate();
88 }); 67 });
89
90 integration("warns about overridden dependencies", () { 68 integration("warns about overridden dependencies", () {
91 servePackages((builder) { 69 servePackages((builder) {
92 builder.serve("foo", "1.0.0"); 70 builder.serve("foo", "1.0.0");
93 builder.serve("bar", "1.0.0"); 71 builder.serve("bar", "1.0.0");
94 }); 72 });
95 73 d.dir("baz", [d.libDir("baz"), d.libPubspec("baz", "0.0.1")]).create();
96 d.dir("baz", [ 74 d.dir(appPath, [d.pubspec({
97 d.libDir("baz"),
98 d.libPubspec("baz", "0.0.1")
99 ]).create();
100
101 d.dir(appPath, [
102 d.pubspec({
103 "name": "myapp", 75 "name": "myapp",
104 "dependency_overrides": { 76 "dependency_overrides": {
105 "foo": "any", 77 "foo": "any",
106 "bar": "any", 78 "bar": "any",
107 "baz": {"path": "../baz"} 79 "baz": {
80 "path": "../baz"
81 }
108 } 82 }
109 }) 83 })]).create();
110 ]).create();
111
112 var bazPath = path.join("..", "baz"); 84 var bazPath = path.join("..", "baz");
113 85 schedulePub(args: [command.name], output: command.success, error: """
114 schedulePub(args: [command.name], output: command.success, error:
115 """
116 Warning: You are using these overridden dependencies: 86 Warning: You are using these overridden dependencies:
117 ! bar 1.0.0 87 ! bar 1.0.0
118 ! baz 0.0.1 from path $bazPath 88 ! baz 0.0.1 from path $bazPath
119 ! foo 1.0.0 89 ! foo 1.0.0
120 """); 90 """);
121 }); 91 });
122 }); 92 });
123 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698