@@ -2316,6 +2316,83 @@ fn update_breaking_spec_version() {
2316
2316
. run ( ) ;
2317
2317
}
2318
2318
2319
+ #[ cargo_test]
2320
+ fn update_breaking_spec_version_transitive ( ) {
2321
+ Package :: new ( "dep" , "1.0.0" ) . publish ( ) ;
2322
+ Package :: new ( "dep" , "1.1.0" ) . publish ( ) ;
2323
+
2324
+ let p = project ( )
2325
+ . file (
2326
+ "Cargo.toml" ,
2327
+ r#"
2328
+ [package]
2329
+ name = "foo"
2330
+ version = "0.0.1"
2331
+ edition = "2015"
2332
+ authors = []
2333
+
2334
+ [dependencies]
2335
+ dep = "1.0"
2336
+ bar = { path = "bar", version = "0.0.1" }
2337
+ "# ,
2338
+ )
2339
+ . file ( "src/lib.rs" , "" )
2340
+ . file (
2341
+ "bar/Cargo.toml" ,
2342
+ r#"
2343
+ [package]
2344
+ name = "bar"
2345
+ version = "0.0.1"
2346
+ edition = "2015"
2347
+ authors = []
2348
+
2349
+ [dependencies]
2350
+ dep = "1.1"
2351
+ "# ,
2352
+ )
2353
+ . file ( "bar/src/lib.rs" , "" )
2354
+ . build ( ) ;
2355
+
2356
+ p. cargo ( "generate-lockfile" ) . run ( ) ;
2357
+
2358
+ Package :: new ( "dep" , "1.1.1" ) . publish ( ) ;
2359
+ Package :: new ( "dep" , "2.0.0" ) . publish ( ) ;
2360
+
2361
+ // Can upgrade the direct dependency
2362
+ p
. cargo ( "update -Zunstable-options --breaking [email protected] " )
2363
+ . masquerade_as_nightly_cargo ( & [ "update-breaking" ] )
2364
+ . with_stderr (
2365
+ "\
2366
+ [UPDATING] `[..]` index
2367
+ [UPGRADING] dep ^1.0 -> ^2.0
2368
+ [LOCKING] 1 package to latest compatible version
2369
+ [ADDING] dep v2.0.0
2370
+ " ,
2371
+ )
2372
+ . run ( ) ;
2373
+
2374
+ // But not the transitive one
2375
+ p
. cargo ( "update -Zunstable-options --breaking [email protected] " )
2376
+ . masquerade_as_nightly_cargo ( & [ "update-breaking" ] )
2377
+ . with_stderr (
2378
+ "\
2379
+ [UPDATING] `[..]` index
2380
+ " ,
2381
+ )
2382
+ . run ( ) ;
2383
+
2384
+ // But a non-breaking update can
2385
+ p
. cargo ( "update [email protected] " )
2386
+ . with_stderr (
2387
+ "\
2388
+ [UPDATING] `[..]` index
2389
+ [LOCKING] 1 package to latest compatible version
2390
+ [UPDATING] dep v1.1.0 -> v1.1.1 (latest: v2.0.0)
2391
+ " ,
2392
+ )
2393
+ . run ( ) ;
2394
+ }
2395
+
2319
2396
#[ cargo_test]
2320
2397
fn update_breaking_mixed_compatibility ( ) {
2321
2398
Package :: new ( "mixed-compatibility" , "1.0.0" ) . publish ( ) ;
0 commit comments