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('pub_tests'); | 5 #library('pub_tests'); |
6 | 6 |
7 #import('dart:io'); | 7 #import('dart:io'); |
8 | 8 |
9 #import('test_pub.dart'); | 9 #import('test_pub.dart'); |
10 #import('../../../pkg/unittest/unittest.dart'); | 10 #import('../../../pkg/unittest/unittest.dart'); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 packagesDir({ | 223 packagesDir({ |
224 "foo": "1.0.0", | 224 "foo": "1.0.0", |
225 "bar": "1.0.0", | 225 "bar": "1.0.0", |
226 "baz": "1.0.0", | 226 "baz": "1.0.0", |
227 "newdep": "2.0.0" | 227 "newdep": "2.0.0" |
228 }).scheduleValidate(); | 228 }).scheduleValidate(); |
229 | 229 |
230 run(); | 230 run(); |
231 }); | 231 }); |
| 232 |
| 233 test("removes a dependency that's been removed from the pubspec", () { |
| 234 servePackages([ |
| 235 package("foo", "1.0.0"), |
| 236 package("bar", "1.0.0") |
| 237 ]); |
| 238 |
| 239 appDir([dependency("foo"), dependency("bar")]).scheduleCreate(); |
| 240 |
| 241 schedulePub(args: ['install'], |
| 242 output: const RegExp(@"Dependencies installed!$")); |
| 243 |
| 244 packagesDir({ |
| 245 "foo": "1.0.0", |
| 246 "bar": "1.0.0" |
| 247 }).scheduleValidate(); |
| 248 |
| 249 appDir([dependency("foo")]).scheduleCreate(); |
| 250 |
| 251 schedulePub(args: ['install'], |
| 252 output: const RegExp(@"Dependencies installed!$")); |
| 253 |
| 254 packagesDir({ |
| 255 "foo": "1.0.0", |
| 256 "bar": null |
| 257 }).scheduleValidate(); |
| 258 |
| 259 run(); |
| 260 }); |
| 261 |
| 262 test("removes a transitive dependency that's no longer depended on", () { |
| 263 servePackages([ |
| 264 package("foo", "1.0.0", [dependency("shared-dep")]), |
| 265 package("bar", "1.0.0", [ |
| 266 dependency("shared-dep"), |
| 267 dependency("bar-dep") |
| 268 ]), |
| 269 package("shared-dep", "1.0.0"), |
| 270 package("bar-dep", "1.0.0") |
| 271 ]); |
| 272 |
| 273 appDir([dependency("foo"), dependency("bar")]).scheduleCreate(); |
| 274 |
| 275 schedulePub(args: ['install'], |
| 276 output: const RegExp(@"Dependencies installed!$")); |
| 277 |
| 278 packagesDir({ |
| 279 "foo": "1.0.0", |
| 280 "bar": "1.0.0", |
| 281 "shared-dep": "1.0.0", |
| 282 "bar-dep": "1.0.0", |
| 283 }).scheduleValidate(); |
| 284 |
| 285 appDir([dependency("foo")]).scheduleCreate(); |
| 286 |
| 287 schedulePub(args: ['install'], |
| 288 output: const RegExp(@"Dependencies installed!$")); |
| 289 |
| 290 packagesDir({ |
| 291 "foo": "1.0.0", |
| 292 "bar": null, |
| 293 "shared-dep": "1.0.0", |
| 294 "bar-dep": null, |
| 295 }).scheduleValidate(); |
| 296 |
| 297 run(); |
| 298 }); |
| 299 |
| 300 test("doesn't update dependencies whose constraints have been removed", () { |
| 301 servePackages([ |
| 302 package("foo", "1.0.0", [dependency("shared-dep")]), |
| 303 package("bar", "1.0.0", [dependency("shared-dep", "<2.0.0")]), |
| 304 package("shared-dep", "1.0.0"), |
| 305 package("shared-dep", "2.0.0") |
| 306 ]); |
| 307 |
| 308 appDir([dependency("foo"), dependency("bar")]).scheduleCreate(); |
| 309 |
| 310 schedulePub(args: ['install'], |
| 311 output: const RegExp(@"Dependencies installed!$")); |
| 312 |
| 313 packagesDir({ |
| 314 "foo": "1.0.0", |
| 315 "bar": "1.0.0", |
| 316 "shared-dep": "1.0.0" |
| 317 }).scheduleValidate(); |
| 318 |
| 319 appDir([dependency("foo")]).scheduleCreate(); |
| 320 |
| 321 schedulePub(args: ['install'], |
| 322 output: const RegExp(@"Dependencies installed!$")); |
| 323 |
| 324 packagesDir({ |
| 325 "foo": "1.0.0", |
| 326 "bar": null, |
| 327 "shared-dep": "1.0.0" |
| 328 }).scheduleValidate(); |
| 329 |
| 330 run(); |
| 331 }); |
232 } | 332 } |
OLD | NEW |