OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 library check_sdk_test; | 5 library check_sdk_test; |
6 | 6 |
7 import '../../../pkg/scheduled_test/lib/scheduled_test.dart'; | |
8 | |
9 import 'descriptor.dart' as d; | |
10 import "test_pub.dart"; | 7 import "test_pub.dart"; |
| 8 import "../../../pkg/unittest/lib/unittest.dart"; |
11 | 9 |
12 main() { | 10 main() { |
13 initConfig(); | 11 initConfig(); |
14 | 12 |
15 for (var command in ["install", "update"]) { | 13 for (var command in ["install", "update"]) { |
16 var success = new RegExp(r"Dependencies installed!$"); | 14 var success = new RegExp(r"Dependencies installed!$"); |
17 if (command == "update") { | 15 if (command == "update") { |
18 success = new RegExp(r"Dependencies updated!$"); | 16 success = new RegExp(r"Dependencies updated!$"); |
19 } | 17 } |
20 | 18 |
21 integration("gives a friendly message if there are no constraints", () { | 19 integration("gives a friendly message if there are no constraints", () { |
22 d.dir(appPath, [ | 20 dir(appPath, [ |
23 d.pubspec({"name": "myapp"}), | 21 pubspec({"name": "myapp"}), |
24 ]).create(); | 22 ]).scheduleCreate(); |
25 | 23 |
26 schedulePub(args: [command], output: success); | 24 schedulePub(args: [command], output: success); |
27 }); | 25 }); |
28 | 26 |
29 integration("gives an error if the root package does not match", () { | 27 integration("gives an error if the root package does not match", () { |
30 d.dir(appPath, [ | 28 dir(appPath, [ |
31 d.pubspec({ | 29 pubspec({ |
32 "name": "myapp", | 30 "name": "myapp", |
33 "environment": {"sdk": ">2.0.0"} | 31 "environment": {"sdk": ">2.0.0"} |
34 }) | 32 }) |
35 ]).create(); | 33 ]).scheduleCreate(); |
36 | 34 |
37 schedulePub(args: [command], | 35 schedulePub(args: [command], |
38 error: | 36 error: |
39 """ | 37 """ |
40 Some packages that were installed are not compatible with your SDK v
ersion 0.1.2+3 and may not work: | 38 Some packages that were installed are not compatible with your SDK v
ersion 0.1.2+3 and may not work: |
41 - 'myapp' requires >2.0.0 | 39 - 'myapp' requires >2.0.0 |
42 | 40 |
43 You may be able to resolve this by upgrading to the latest Dart SDK | 41 You may be able to resolve this by upgrading to the latest Dart SDK |
44 or adding a version constraint to use an older version of a package. | 42 or adding a version constraint to use an older version of a package. |
45 """); | 43 """); |
46 }); | 44 }); |
47 | 45 |
48 integration("gives an error if some dependencies do not match", () { | 46 integration("gives an error if some dependencies do not match", () { |
49 // Using a path source, but this should be true of all sources. | 47 // Using a path source, but this should be true of all sources. |
50 d.dir("foo", [ | 48 dir("foo", [ |
51 d.libPubspec("foo", "0.0.1", sdk: ">0.1.3"), | 49 libPubspec("foo", "0.0.1", sdk: ">0.1.3"), |
52 d.libDir("foo") | 50 libDir("foo") |
53 ]).create(); | 51 ]).scheduleCreate(); |
54 d.dir("bar", [ | 52 dir("bar", [ |
55 d.libPubspec("bar", "0.0.1", sdk: ">0.1.1"), | 53 libPubspec("bar", "0.0.1", sdk: ">0.1.1"), |
56 d.libDir("bar") | 54 libDir("bar") |
57 ]).create(); | 55 ]).scheduleCreate(); |
58 | 56 |
59 d.dir(appPath, [ | 57 dir(appPath, [ |
60 d.pubspec({ | 58 pubspec({ |
61 "name": "myapp", | 59 "name": "myapp", |
62 "dependencies": { | 60 "dependencies": { |
63 "foo": {"path": "../foo"}, | 61 "foo": {"path": "../foo"}, |
64 "bar": {"path": "../bar"} | 62 "bar": {"path": "../bar"} |
65 }, | 63 }, |
66 "environment": {"sdk": ">2.0.0"} | 64 "environment": {"sdk": ">2.0.0"} |
67 }) | 65 }) |
68 ]).create(); | 66 ]).scheduleCreate(); |
69 | 67 |
70 schedulePub(args: [command], | 68 schedulePub(args: [command], |
71 error: | 69 error: |
72 """ | 70 """ |
73 Some packages that were installed are not compatible with your SDK v
ersion 0.1.2+3 and may not work: | 71 Some packages that were installed are not compatible with your SDK v
ersion 0.1.2+3 and may not work: |
74 - 'myapp' requires >2.0.0 | 72 - 'myapp' requires >2.0.0 |
75 - 'foo' requires >0.1.3 | 73 - 'foo' requires >0.1.3 |
76 | 74 |
77 You may be able to resolve this by upgrading to the latest Dart SDK | 75 You may be able to resolve this by upgrading to the latest Dart SDK |
78 or adding a version constraint to use an older version of a package. | 76 or adding a version constraint to use an older version of a package. |
79 """); | 77 """); |
80 }); | 78 }); |
81 | 79 |
82 integration("gives an error if a transitive dependency doesn't match", () { | 80 integration("gives an error if a transitive dependency doesn't match", () { |
83 // Using a path source, but this should be true of all sources. | 81 // Using a path source, but this should be true of all sources. |
84 d.dir("foo", [ | 82 dir("foo", [ |
85 d.libPubspec("foo", "0.0.1", deps: [ | 83 libPubspec("foo", "0.0.1", deps: [ |
86 {"path": "../bar"} | 84 {"path": "../bar"} |
87 ]), | 85 ]), |
88 d.libDir("foo") | 86 libDir("foo") |
89 ]).create(); | 87 ]).scheduleCreate(); |
90 d.dir("bar", [ | 88 dir("bar", [ |
91 d.libPubspec("bar", "0.0.1", sdk: "<0.1.1"), | 89 libPubspec("bar", "0.0.1", sdk: "<0.1.1"), |
92 d.libDir("bar") | 90 libDir("bar") |
93 ]).create(); | 91 ]).scheduleCreate(); |
94 | 92 |
95 d.dir(appPath, [ | 93 dir(appPath, [ |
96 d.pubspec({ | 94 pubspec({ |
97 "name": "myapp", | 95 "name": "myapp", |
98 "dependencies": { | 96 "dependencies": { |
99 "foo": {"path": "../foo"} | 97 "foo": {"path": "../foo"} |
100 } | 98 } |
101 }) | 99 }) |
102 ]).create(); | 100 ]).scheduleCreate(); |
103 | 101 |
104 schedulePub(args: [command], | 102 schedulePub(args: [command], |
105 error: | 103 error: |
106 """ | 104 """ |
107 Some packages that were installed are not compatible with your SDK v
ersion 0.1.2+3 and may not work: | 105 Some packages that were installed are not compatible with your SDK v
ersion 0.1.2+3 and may not work: |
108 - 'bar' requires <0.1.1 | 106 - 'bar' requires <0.1.1 |
109 | 107 |
110 You may be able to resolve this by upgrading to the latest Dart SDK | 108 You may be able to resolve this by upgrading to the latest Dart SDK |
111 or adding a version constraint to use an older version of a package. | 109 or adding a version constraint to use an older version of a package. |
112 """); | 110 """); |
113 }); | 111 }); |
114 | 112 |
115 integration("handles a circular dependency on the root package", () { | 113 integration("handles a circular dependency on the root package", () { |
116 // Using a path source, but this should be true of all sources. | 114 // Using a path source, but this should be true of all sources. |
117 d.dir("foo", [ | 115 dir("foo", [ |
118 d.libPubspec("foo", "0.0.1", sdk: ">3.0.0", deps: [ | 116 libPubspec("foo", "0.0.1", sdk: ">3.0.0", deps: [ |
119 {"path": "../myapp"} | 117 {"path": "../myapp"} |
120 ]), | 118 ]), |
121 d.libDir("foo") | 119 libDir("foo") |
122 ]).create(); | 120 ]).scheduleCreate(); |
123 | 121 |
124 d.dir(appPath, [ | 122 dir(appPath, [ |
125 d.pubspec({ | 123 pubspec({ |
126 "name": "myapp", | 124 "name": "myapp", |
127 "dependencies": { | 125 "dependencies": { |
128 "foo": {"path": "../foo"} | 126 "foo": {"path": "../foo"} |
129 }, | 127 }, |
130 "environment": {"sdk": ">2.0.0"} | 128 "environment": {"sdk": ">2.0.0"} |
131 }) | 129 }) |
132 ]).create(); | 130 ]).scheduleCreate(); |
133 | 131 |
134 schedulePub(args: [command], | 132 schedulePub(args: [command], |
135 error: | 133 error: |
136 """ | 134 """ |
137 Some packages that were installed are not compatible with your SDK v
ersion 0.1.2+3 and may not work: | 135 Some packages that were installed are not compatible with your SDK v
ersion 0.1.2+3 and may not work: |
138 - 'myapp' requires >2.0.0 | 136 - 'myapp' requires >2.0.0 |
139 - 'foo' requires >3.0.0 | 137 - 'foo' requires >3.0.0 |
140 | 138 |
141 You may be able to resolve this by upgrading to the latest Dart SDK | 139 You may be able to resolve this by upgrading to the latest Dart SDK |
142 or adding a version constraint to use an older version of a package. | 140 or adding a version constraint to use an older version of a package. |
143 """); | 141 """); |
144 }); | 142 }); |
145 } | 143 } |
146 } | 144 } |
OLD | NEW |