@@ -1415,6 +1415,46 @@ fn path_install_workspace_root_despite_default_members() {
1415
1415
. run ( ) ;
1416
1416
}
1417
1417
1418
+ #[ cargo_test]
1419
+ fn git_install_workspace_root_despite_default_members ( ) {
1420
+ let p = git:: repo ( & paths:: root ( ) . join ( "foo" ) )
1421
+ . file (
1422
+ "Cargo.toml" ,
1423
+ r#"
1424
+ [package]
1425
+ name = "ws-root"
1426
+ version = "0.1.0"
1427
+ authors = []
1428
+
1429
+ [workspace]
1430
+ members = ["ws-member"]
1431
+ default-members = ["ws-member"]
1432
+ "# ,
1433
+ )
1434
+ . file ( "src/main.rs" , "fn main() {}" )
1435
+ . file (
1436
+ "ws-member/Cargo.toml" ,
1437
+ r#"
1438
+ [package]
1439
+ name = "ws-member"
1440
+ version = "0.1.0"
1441
+ authors = []
1442
+ "# ,
1443
+ )
1444
+ . file ( "ws-member/src/main.rs" , "fn main() {}" )
1445
+ . build ( ) ;
1446
+
1447
+ cargo_process ( "install --git" )
1448
+ . arg ( p. url ( ) . to_string ( ) )
1449
+ . arg ( "ws-root" )
1450
+ . with_stderr_contains (
1451
+ "[INSTALLED] package `ws-root v0.1.0 ([..])` (executable `ws-root[EXE]`)" ,
1452
+ )
1453
+ // Particularly avoid "Installed package `ws-root v0.1.0 ([..]])` (executable `ws-member`)":
1454
+ . with_stderr_does_not_contain ( "ws-member" )
1455
+ . run ( ) ;
1456
+ }
1457
+
1418
1458
#[ cargo_test]
1419
1459
fn dev_dependencies_no_check ( ) {
1420
1460
Package :: new ( "foo" , "1.0.0" ) . publish ( ) ;
@@ -2287,3 +2327,84 @@ fn sparse_install() {
2287
2327
"# ,
2288
2328
) ;
2289
2329
}
2330
+
2331
+ #[ cargo_test]
2332
+ fn self_referential ( ) {
2333
+ // Some packages build-dep on prior versions of themselves.
2334
+ Package :: new ( "foo" , "0.0.1" )
2335
+ . file ( "src/lib.rs" , "fn hello() {}" )
2336
+ . file ( "src/main.rs" , "fn main() {}" )
2337
+ . file ( "build.rs" , "fn main() {}" )
2338
+ . publish ( ) ;
2339
+ Package :: new ( "foo" , "0.0.2" )
2340
+ . file ( "src/lib.rs" , "fn hello() {}" )
2341
+ . file ( "src/main.rs" , "fn main() {}" )
2342
+ . file ( "build.rs" , "fn main() {}" )
2343
+ . build_dep ( "foo" , "0.0.1" )
2344
+ . publish ( ) ;
2345
+
2346
+ cargo_process ( "install foo" )
2347
+ . with_stderr (
2348
+ "\
2349
+ [UPDATING] `[..]` index
2350
+ [DOWNLOADING] crates ...
2351
+ [DOWNLOADED] foo v0.0.2 (registry [..])
2352
+ [INSTALLING] foo v0.0.2
2353
+ [DOWNLOADING] crates ...
2354
+ [DOWNLOADED] foo v0.0.1 (registry [..])
2355
+ [COMPILING] foo v0.0.1
2356
+ [COMPILING] foo v0.0.2
2357
+ [FINISHED] release [optimized] target(s) in [..]
2358
+ [INSTALLING] [CWD]/home/.cargo/bin/foo[EXE]
2359
+ [INSTALLED] package `foo v0.0.2` (executable `foo[EXE]`)
2360
+ [WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries
2361
+ " ,
2362
+ )
2363
+ . run ( ) ;
2364
+ assert_has_installed_exe ( cargo_home ( ) , "foo" ) ;
2365
+ }
2366
+
2367
+ #[ cargo_test]
2368
+ fn ambiguous_registry_vs_local_package ( ) {
2369
+ // Correctly install 'foo' from a local package, even if that package also
2370
+ // depends on a registry dependency named 'foo'.
2371
+ Package :: new ( "foo" , "0.0.1" )
2372
+ . file ( "src/lib.rs" , "fn hello() {}" )
2373
+ . publish ( ) ;
2374
+
2375
+ let p = project ( )
2376
+ . file ( "src/main.rs" , "fn main() {}" )
2377
+ . file (
2378
+ "Cargo.toml" ,
2379
+ r#"
2380
+ [package]
2381
+ name = "foo"
2382
+ version = "0.1.0"
2383
+ authors = []
2384
+ edition = "2021"
2385
+
2386
+ [dependencies]
2387
+ foo = "0.0.1"
2388
+ "# ,
2389
+ )
2390
+ . build ( ) ;
2391
+
2392
+ cargo_process ( "install --path" )
2393
+ . arg ( p. root ( ) )
2394
+ . with_stderr (
2395
+ "\
2396
+ [INSTALLING] foo v0.1.0 ([..])
2397
+ [UPDATING] `[..]` index
2398
+ [DOWNLOADING] crates ...
2399
+ [DOWNLOADED] foo v0.0.1 (registry [..])
2400
+ [COMPILING] foo v0.0.1
2401
+ [COMPILING] foo v0.1.0 ([..])
2402
+ [FINISHED] release [optimized] target(s) in [..]
2403
+ [INSTALLING] [CWD]/home/.cargo/bin/foo[EXE]
2404
+ [INSTALLED] package `foo v0.1.0 ([..])` (executable `foo[EXE]`)
2405
+ [WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries
2406
+ " ,
2407
+ )
2408
+ . run ( ) ;
2409
+ assert_has_installed_exe ( cargo_home ( ) , "foo" ) ;
2410
+ }
0 commit comments