File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -979,6 +979,58 @@ fn publish_implicitly_to_only_allowed_registry() {
979979 ) ;
980980}
981981
982+ #[ cargo_test]
983+ fn publish_when_both_publish_and_index_specified ( ) {
984+ let registry = RegistryBuilder :: new ( )
985+ . http_api ( )
986+ . http_index ( )
987+ . alternative ( )
988+ . build ( ) ;
989+
990+ let p = project ( ) . build ( ) ;
991+
992+ let _ = repo ( & paths:: root ( ) . join ( "foo" ) )
993+ . file (
994+ "Cargo.toml" ,
995+ r#"
996+ [package]
997+ name = "foo"
998+ version = "0.0.1"
999+ edition = "2015"
1000+ authors = []
1001+ license = "MIT"
1002+ description = "foo"
1003+ documentation = "foo"
1004+ homepage = "foo"
1005+ repository = "foo"
1006+ publish = ["registry"]
1007+ "# ,
1008+ )
1009+ . file ( "src/main.rs" , "fn main() {}" )
1010+ . build ( ) ;
1011+
1012+ p. cargo ( "publish" )
1013+ . arg ( "--index" )
1014+ . arg ( registry. index_url ( ) . as_str ( ) )
1015+ . arg ( "--token" )
1016+ . arg ( registry. token ( ) )
1017+ . with_stderr_data ( str![ [ r#"
1018+ [WARNING] `cargo publish --token` is deprecated in favor of using `cargo login` and environment variables
1019+ [UPDATING] [..] index
1020+ [PACKAGING] foo v0.0.1 ([ROOT]/foo)
1021+ [PACKAGED] 5 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
1022+ [VERIFYING] foo v0.0.1 ([ROOT]/foo)
1023+ [COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1)
1024+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
1025+ [UPLOADING] foo v0.0.1 ([ROOT]/foo)
1026+ [UPLOADED] foo v0.0.1 to registry [..]
1027+ [NOTE] waiting for foo v0.0.1 to be available at registry [..]
1028+ [HELP] you may press ctrl-c to skip waiting; the crate should be available shortly
1029+ [PUBLISHED] foo v0.0.1 at registry [..]
1030+ "# ] ] )
1031+ . run ( ) ;
1032+ }
1033+
9821034#[ cargo_test]
9831035fn publish_failed_with_index_and_only_allowed_registry ( ) {
9841036 let registry = RegistryBuilder :: new ( )
You can’t perform that action at this time.
0 commit comments