@@ -3364,6 +3364,94 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
3364
3364
. run ( ) ;
3365
3365
}
3366
3366
3367
+ #[ cargo_test]
3368
+ fn package_selection ( ) {
3369
+ let registry = registry:: RegistryBuilder :: new ( ) . http_api ( ) . build ( ) ;
3370
+ let p = project ( )
3371
+ . file (
3372
+ "Cargo.toml" ,
3373
+ r#"
3374
+ [workspace]
3375
+ members = ["a", "b"]
3376
+ "# ,
3377
+ )
3378
+ . file ( "a/Cargo.toml" , & basic_manifest ( "a" , "0.1.0" ) )
3379
+ . file ( "a/src/lib.rs" , "#[test] fn a() {}" )
3380
+ . file ( "b/Cargo.toml" , & basic_manifest ( "b" , "0.1.0" ) )
3381
+ . file ( "b/src/lib.rs" , "#[test] fn b() {}" )
3382
+ . build ( ) ;
3383
+
3384
+ p. cargo ( "publish --no-verify --dry-run -Zpackage-workspace --workspace" )
3385
+ . replace_crates_io ( registry. index_url ( ) )
3386
+ . masquerade_as_nightly_cargo ( & [ "package-workspace" ] )
3387
+ . with_stderr_data ( str![ [ r#"
3388
+ [UPDATING] crates.io index
3389
+ [WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
3390
+ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
3391
+ [PACKAGING] a v0.1.0 ([ROOT]/foo/a)
3392
+ [PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
3393
+ [WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
3394
+ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
3395
+ [PACKAGING] b v0.1.0 ([ROOT]/foo/b)
3396
+ [PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
3397
+ [UPLOADING] a v0.1.0 ([ROOT]/foo/a)
3398
+ [WARNING] aborting upload due to dry run
3399
+ [UPLOADING] b v0.1.0 ([ROOT]/foo/b)
3400
+ [WARNING] aborting upload due to dry run
3401
+
3402
+ "# ] ] )
3403
+ . with_stdout_data ( str![ [ r#""# ] ] )
3404
+ . run ( ) ;
3405
+
3406
+ p. cargo ( "publish --no-verify --dry-run -Zpackage-workspace --package a --package b" )
3407
+ . replace_crates_io ( registry. index_url ( ) )
3408
+ . masquerade_as_nightly_cargo ( & [ "package-workspace" ] )
3409
+ . with_stderr_data ( str![ [ r#"
3410
+ [UPDATING] crates.io index
3411
+ [WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
3412
+ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
3413
+ [PACKAGING] a v0.1.0 ([ROOT]/foo/a)
3414
+ [PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
3415
+ [WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
3416
+ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
3417
+ [PACKAGING] b v0.1.0 ([ROOT]/foo/b)
3418
+ [PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
3419
+ [UPLOADING] a v0.1.0 ([ROOT]/foo/a)
3420
+ [WARNING] aborting upload due to dry run
3421
+ [UPLOADING] b v0.1.0 ([ROOT]/foo/b)
3422
+ [WARNING] aborting upload due to dry run
3423
+
3424
+ "# ] ] )
3425
+ . with_stdout_data ( str![ [ r#""# ] ] )
3426
+ . run ( ) ;
3427
+
3428
+ p. cargo ( "publish --no-verify --dry-run -Zpackage-workspace --workspace --exclude b" )
3429
+ . replace_crates_io ( registry. index_url ( ) )
3430
+ . masquerade_as_nightly_cargo ( & [ "package-workspace" ] )
3431
+ . with_stderr_data ( str![ [ r#"
3432
+ [UPDATING] crates.io index
3433
+ [WARNING] manifest has no description, license, license-file, documentation, homepage or repository.
3434
+ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
3435
+ [PACKAGING] a v0.1.0 ([ROOT]/foo/a)
3436
+ [PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
3437
+ [UPLOADING] a v0.1.0 ([ROOT]/foo/a)
3438
+ [WARNING] aborting upload due to dry run
3439
+
3440
+ "# ] ] )
3441
+ . with_stdout_data ( str![ [ r#""# ] ] )
3442
+ . run ( ) ;
3443
+
3444
+ p. cargo ( "publish --no-verify --dry-run --package a --package b" )
3445
+ . replace_crates_io ( registry. index_url ( ) )
3446
+ . with_status ( 101 )
3447
+ . with_stderr_data ( str![ [ r#"
3448
+ [ERROR] the `-p` argument must be specified to select a single package to publish
3449
+
3450
+ "# ] ] )
3451
+ . with_stdout_data ( str![ [ r#""# ] ] )
3452
+ . run ( ) ;
3453
+ }
3454
+
3367
3455
#[ cargo_test]
3368
3456
fn wait_for_git_publish ( ) {
3369
3457
// Slow publish to an index with a git index.
0 commit comments