@@ -494,32 +494,25 @@ fn when_cargo_home_is_the_default_write_path_specially() {
494494
495495#[ test]
496496#[ cfg( windows) ]
497- fn install_adds_path ( ) {
497+ /// Smoke test for end-to-end code connectivity of the installer path mgmt on windows.
498+ fn install_uninstall_affect_path ( ) {
498499 setup ( & |config| {
499- expect_ok ( config, & [ "rustup-init" , "-y" ] ) ;
500-
501500 let path = config. cargodir . join ( "bin" ) . to_string_lossy ( ) . to_string ( ) ;
501+
502+ expect_ok ( config, & [ "rustup-init" , "-y" ] ) ;
502503 assert ! (
503504 get_path( ) . unwrap( ) . contains( & path) ,
504505 format!( "`{}` not in `{}`" , get_path( ) . unwrap( ) , & path)
505506 ) ;
506- } ) ;
507- }
508507
509- #[ test]
510- #[ cfg( windows) ]
511- fn uninstall_removes_path ( ) {
512- setup ( & |config| {
513- expect_ok ( config, & [ "rustup-init" , "-y" ] ) ;
514508 expect_ok ( config, & [ "rustup" , "self" , "uninstall" , "-y" ] ) ;
515-
516- let path = config. cargodir . join ( "bin" ) . to_string_lossy ( ) . to_string ( ) ;
517509 assert ! ( !get_path( ) . unwrap( ) . contains( & path) ) ;
518510 } ) ;
519511}
520512
521513#[ test]
522514#[ cfg( unix) ]
515+ /// This covers both windows and unix no-path-modification cases due to the code structure.
523516fn install_doesnt_modify_path_if_passed_no_modify_path ( ) {
524517 setup ( & |config| {
525518 let profile = config. homedir . join ( ".profile" ) ;
@@ -528,31 +521,6 @@ fn install_doesnt_modify_path_if_passed_no_modify_path() {
528521 } ) ;
529522}
530523
531- #[ test]
532- #[ cfg( windows) ]
533- fn install_doesnt_modify_path_if_passed_no_modify_path ( ) {
534- use winreg:: enums:: { HKEY_CURRENT_USER , KEY_READ , KEY_WRITE } ;
535- use winreg:: RegKey ;
536-
537- setup ( & |config| {
538- let root = RegKey :: predef ( HKEY_CURRENT_USER ) ;
539- let environment = root
540- . open_subkey_with_flags ( "Environment" , KEY_READ | KEY_WRITE )
541- . unwrap ( ) ;
542- let old_path = environment. get_raw_value ( "PATH" ) . unwrap ( ) ;
543-
544- expect_ok ( config, & [ "rustup-init" , "-y" , "--no-modify-path" ] ) ;
545-
546- let root = RegKey :: predef ( HKEY_CURRENT_USER ) ;
547- let environment = root
548- . open_subkey_with_flags ( "Environment" , KEY_READ | KEY_WRITE )
549- . unwrap ( ) ;
550- let new_path = environment. get_raw_value ( "PATH" ) . unwrap ( ) ;
551-
552- assert_eq ! ( old_path, new_path) ;
553- } ) ;
554- }
555-
556524#[ test]
557525fn update_exact ( ) {
558526 let version = env ! ( "CARGO_PKG_VERSION" ) ;
@@ -951,10 +919,6 @@ fn produces_env_file_on_unix() {
951919 } ) ;
952920}
953921
954- #[ test]
955- #[ cfg( windows) ]
956- fn doesnt_produce_env_file_on_windows ( ) { }
957-
958922#[ test]
959923fn install_sets_up_stable ( ) {
960924 setup ( & |config| {
@@ -1015,42 +979,6 @@ fn rustup_init_works_with_weird_names() {
1015979 } ) ;
1016980}
1017981
1018- // HKCU\Environment\PATH may not exist during install, and it may need to be
1019- // deleted during uninstall if we remove the last path from it
1020- #[ test]
1021- #[ cfg( windows) ]
1022- fn windows_handle_empty_path_registry_key ( ) {
1023- use winreg:: enums:: { RegType , HKEY_CURRENT_USER , KEY_READ , KEY_WRITE } ;
1024- use winreg:: RegKey ;
1025-
1026- setup ( & |config| {
1027- let root = RegKey :: predef ( HKEY_CURRENT_USER ) ;
1028- let environment = root
1029- . open_subkey_with_flags ( "Environment" , KEY_READ | KEY_WRITE )
1030- . unwrap ( ) ;
1031- let _ = environment. delete_value ( "PATH" ) ;
1032-
1033- expect_ok ( config, & [ "rustup-init" , "-y" ] ) ;
1034-
1035- let root = RegKey :: predef ( HKEY_CURRENT_USER ) ;
1036- let environment = root
1037- . open_subkey_with_flags ( "Environment" , KEY_READ | KEY_WRITE )
1038- . unwrap ( ) ;
1039- let path = environment. get_raw_value ( "PATH" ) . unwrap ( ) ;
1040- assert ! ( path. vtype == RegType :: REG_EXPAND_SZ ) ;
1041-
1042- expect_ok ( config, & [ "rustup" , "self" , "uninstall" , "-y" ] ) ;
1043-
1044- let root = RegKey :: predef ( HKEY_CURRENT_USER ) ;
1045- let environment = root
1046- . open_subkey_with_flags ( "Environment" , KEY_READ | KEY_WRITE )
1047- . unwrap ( ) ;
1048- let path = environment. get_raw_value ( "PATH" ) ;
1049-
1050- assert ! ( path. is_err( ) ) ;
1051- } ) ;
1052- }
1053-
1054982#[ test]
1055983#[ ignore] // untestable
1056984fn install_but_rustup_is_installed ( ) { }
0 commit comments