@@ -23,6 +23,9 @@ use rustup::utils::{raw, utils};
2323use rustup:: { for_host, DUP_TOOLS , TOOLS } ;
2424use rustup_macros:: integration_test as test;
2525
26+ #[ cfg( windows) ]
27+ use rustup:: test:: with_saved_reg_value;
28+
2629const TEST_VERSION : & str = "1.1.1" ;
2730
2831pub fn update_setup ( f : & dyn Fn ( & mut Config , & Path ) ) {
@@ -304,7 +307,40 @@ info: downloading self-update
304307 & [ "rustup" , "self" , "update" ] ,
305308 & format ! ( " rustup updated - {version} (from {version})\n \n " , ) ,
306309 & expected_output,
307- )
310+ ) ;
311+ } ) ;
312+ }
313+
314+ #[ test]
315+ #[ cfg( windows) ]
316+ fn update_overwrites_programs_display_version ( ) {
317+ let root = & winreg:: RegKey :: predef ( winreg:: enums:: HKEY_CURRENT_USER ) ;
318+ let key = r"Software\Microsoft\Windows\CurrentVersion\Uninstall\Rustup" ;
319+ let name = "DisplayVersion" ;
320+
321+ const PLACEHOLDER_VERSION : & str = "9.999.99" ;
322+ let version = env ! ( "CARGO_PKG_VERSION" ) ;
323+
324+ update_setup ( & |config, _| {
325+ with_saved_reg_value ( root, key, name, & mut || {
326+ config. expect_ok ( & [ "rustup-init" , "-y" , "--no-modify-path" ] ) ;
327+
328+ root. create_subkey ( key)
329+ . unwrap ( )
330+ . 0
331+ . set_value ( name, & PLACEHOLDER_VERSION )
332+ . unwrap ( ) ;
333+
334+ config. expect_ok ( & [ "rustup" , "self" , "update" ] ) ;
335+
336+ assert_eq ! (
337+ root. open_subkey( key)
338+ . unwrap( )
339+ . get_value:: <String , _>( name)
340+ . unwrap( ) ,
341+ version,
342+ ) ;
343+ } ) ;
308344 } ) ;
309345}
310346
0 commit comments