File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -921,6 +921,48 @@ You may press ctrl-c [..]
921
921
) ;
922
922
}
923
923
924
+ #[ cargo_test]
925
+ fn publish_failed_with_index_and_only_allowed_registry ( ) {
926
+ let registry = RegistryBuilder :: new ( )
927
+ . http_api ( )
928
+ . http_index ( )
929
+ . alternative ( )
930
+ . build ( ) ;
931
+
932
+ let p = project ( ) . build ( ) ;
933
+
934
+ let _ = repo ( & paths:: root ( ) . join ( "foo" ) )
935
+ . file (
936
+ "Cargo.toml" ,
937
+ r#"
938
+ [package]
939
+ name = "foo"
940
+ version = "0.0.1"
941
+ authors = []
942
+ license = "MIT"
943
+ description = "foo"
944
+ documentation = "foo"
945
+ homepage = "foo"
946
+ repository = "foo"
947
+ publish = ["alternative"]
948
+ "# ,
949
+ )
950
+ . file ( "src/main.rs" , "fn main() {}" )
951
+ . build ( ) ;
952
+
953
+ p. cargo ( "publish" )
954
+ . arg ( "--index" )
955
+ . arg ( registry. index_url ( ) . as_str ( ) )
956
+ . with_status ( 101 )
957
+ . with_stderr (
958
+ "\
959
+ [NOTE] Found `alternative` as only allowed registry. Publishing to it automatically.
960
+ [ERROR] command-line argument --index requires --token to be specified
961
+ " ,
962
+ )
963
+ . run ( ) ;
964
+ }
965
+
924
966
#[ cargo_test]
925
967
fn publish_fail_with_no_registry_specified ( ) {
926
968
let p = project ( ) . build ( ) ;
You can’t perform that action at this time.
0 commit comments