Skip to content

Commit

Permalink
test(self-update): ensure the resolution of #3739
Browse files Browse the repository at this point in the history
  • Loading branch information
rami3l committed Apr 14, 2024
1 parent bb96b7f commit d411b70
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion tests/suite/cli_self_upd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,39 @@ info: downloading self-update
&["rustup", "self", "update"],
&format!(" rustup updated - {version} (from {version})\n\n",),
&expected_output,
)
);
});
}

#[test]
#[cfg(windows)]
fn update_overwrites_programs_display_version() {
const RUSTUP_UNINSTALL_ENTRY: &str =
r"Software\Microsoft\Windows\CurrentVersion\Uninstall\Rustup";

const PLACEHOLDER_VERSION: &str = "9.999.99";
let version = env!("CARGO_PKG_VERSION");

update_setup(&|config, _| {
config.expect_ok(&["rustup-init", "-y", "--no-modify-path"]);

winreg::RegKey::predef(winreg::enums::HKEY_CURRENT_USER)
.create_subkey(RUSTUP_UNINSTALL_ENTRY)
.unwrap()
.0
.set_value("DisplayVersion", PLACEHOLDER_VERSION)
.unwrap();

config.expect_ok(&["rustup", "self", "update"]);

assert_eq!(
winreg::RegKey::predef(winreg::enums::HKEY_CURRENT_USER)
.open_subkey(RUSTUP_UNINSTALL_ENTRY)
.unwrap()
.get_value::<String, _>("DisplayVersion")
.unwrap(),
version,
);
});
}

Expand Down

0 comments on commit d411b70

Please sign in to comment.