@@ -494,32 +494,25 @@ fn when_cargo_home_is_the_default_write_path_specially() {
494
494
495
495
#[ test]
496
496
#[ 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 ( ) {
498
499
setup ( & |config| {
499
- expect_ok ( config, & [ "rustup-init" , "-y" ] ) ;
500
-
501
500
let path = config. cargodir . join ( "bin" ) . to_string_lossy ( ) . to_string ( ) ;
501
+
502
+ expect_ok ( config, & [ "rustup-init" , "-y" ] ) ;
502
503
assert ! (
503
504
get_path( ) . unwrap( ) . contains( & path) ,
504
505
format!( "`{}` not in `{}`" , get_path( ) . unwrap( ) , & path)
505
506
) ;
506
- } ) ;
507
- }
508
507
509
- #[ test]
510
- #[ cfg( windows) ]
511
- fn uninstall_removes_path ( ) {
512
- setup ( & |config| {
513
- expect_ok ( config, & [ "rustup-init" , "-y" ] ) ;
514
508
expect_ok ( config, & [ "rustup" , "self" , "uninstall" , "-y" ] ) ;
515
-
516
- let path = config. cargodir . join ( "bin" ) . to_string_lossy ( ) . to_string ( ) ;
517
509
assert ! ( !get_path( ) . unwrap( ) . contains( & path) ) ;
518
510
} ) ;
519
511
}
520
512
521
513
#[ test]
522
514
#[ cfg( unix) ]
515
+ /// This covers both windows and unix no-path-modification cases due to the code structure.
523
516
fn install_doesnt_modify_path_if_passed_no_modify_path ( ) {
524
517
setup ( & |config| {
525
518
let profile = config. homedir . join ( ".profile" ) ;
@@ -528,31 +521,6 @@ fn install_doesnt_modify_path_if_passed_no_modify_path() {
528
521
} ) ;
529
522
}
530
523
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
-
556
524
#[ test]
557
525
fn update_exact ( ) {
558
526
let version = env ! ( "CARGO_PKG_VERSION" ) ;
@@ -951,10 +919,6 @@ fn produces_env_file_on_unix() {
951
919
} ) ;
952
920
}
953
921
954
- #[ test]
955
- #[ cfg( windows) ]
956
- fn doesnt_produce_env_file_on_windows ( ) { }
957
-
958
922
#[ test]
959
923
fn install_sets_up_stable ( ) {
960
924
setup ( & |config| {
@@ -1015,42 +979,6 @@ fn rustup_init_works_with_weird_names() {
1015
979
} ) ;
1016
980
}
1017
981
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
-
1054
982
#[ test]
1055
983
#[ ignore] // untestable
1056
984
fn install_but_rustup_is_installed ( ) { }
0 commit comments