@@ -3364,6 +3364,111 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
33643364 . run ( ) ;
33653365}
33663366
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_status ( 1 )
3388+ . with_stderr_data ( str![ [ r#"
3389+ [ERROR] unexpected argument '--workspace' found
3390+
3391+ Usage: cargo publish --no-verify --dry-run -Z <FLAG>
3392+
3393+ For more information, try '--help'.
3394+
3395+ "# ] ] )
3396+ . with_stdout_data ( str![ [ r#""# ] ] )
3397+ . run ( ) ;
3398+
3399+ p. cargo ( "publish --no-verify --dry-run -Zpackage-workspace --package a --package b" )
3400+ . replace_crates_io ( registry. index_url ( ) )
3401+ . masquerade_as_nightly_cargo ( & [ "package-workspace" ] )
3402+ . with_status ( 1 )
3403+ . with_stderr_data ( str![ [ r#"
3404+ [ERROR] the argument '--package [<SPEC>]' cannot be used multiple times
3405+
3406+ Usage: cargo publish [OPTIONS]
3407+
3408+ For more information, try '--help'.
3409+
3410+ "# ] ] )
3411+ . with_stdout_data ( str![ [ r#""# ] ] )
3412+ . run ( ) ;
3413+
3414+ p. cargo ( "publish --no-verify --dry-run -Zpackage-workspace --workspace --exclude b" )
3415+ . replace_crates_io ( registry. index_url ( ) )
3416+ . masquerade_as_nightly_cargo ( & [ "package-workspace" ] )
3417+ . with_status ( 1 )
3418+ . with_stderr_data ( str![ [ r#"
3419+ [ERROR] unexpected argument '--workspace' found
3420+
3421+ Usage: cargo publish --no-verify --dry-run -Z <FLAG>
3422+
3423+ For more information, try '--help'.
3424+
3425+ "# ] ] )
3426+ . with_stdout_data ( str![ [ r#""# ] ] )
3427+ . run ( ) ;
3428+
3429+ p. cargo ( "publish --no-verify --dry-run --package a --package b" )
3430+ . replace_crates_io ( registry. index_url ( ) )
3431+ . with_status ( 1 )
3432+ . with_stderr_data ( str![ [ r#"
3433+ [ERROR] the argument '--package [<SPEC>]' cannot be used multiple times
3434+
3435+ Usage: cargo publish [OPTIONS]
3436+
3437+ For more information, try '--help'.
3438+
3439+ "# ] ] )
3440+ . with_stdout_data ( str![ [ r#""# ] ] )
3441+ . run ( ) ;
3442+
3443+ p. cargo ( "publish --no-verify --dry-run --workspace" )
3444+ . replace_crates_io ( registry. index_url ( ) )
3445+ . with_status ( 1 )
3446+ . with_stderr_data ( str![ [ r#"
3447+ [ERROR] unexpected argument '--workspace' found
3448+
3449+ Usage: cargo publish --no-verify --dry-run
3450+
3451+ For more information, try '--help'.
3452+
3453+ "# ] ] )
3454+ . with_stdout_data ( str![ [ r#""# ] ] )
3455+ . run ( ) ;
3456+
3457+ p. cargo ( "publish --no-verify --dry-run --exclude b" )
3458+ . replace_crates_io ( registry. index_url ( ) )
3459+ . with_status ( 1 )
3460+ . with_stderr_data ( str![ [ r#"
3461+ [ERROR] unexpected argument '--exclude' found
3462+
3463+ Usage: cargo publish --no-verify --dry-run
3464+
3465+ For more information, try '--help'.
3466+
3467+ "# ] ] )
3468+ . with_stdout_data ( str![ [ r#""# ] ] )
3469+ . run ( ) ;
3470+ }
3471+
33673472#[ cargo_test]
33683473fn wait_for_git_publish ( ) {
33693474 // Slow publish to an index with a git index.
0 commit comments