@@ -23,6 +23,9 @@ use rustup::utils::{raw, utils};
23
23
use rustup:: { for_host, DUP_TOOLS , TOOLS } ;
24
24
use rustup_macros:: integration_test as test;
25
25
26
+ #[ cfg( windows) ]
27
+ use rustup:: test:: with_saved_reg_value;
28
+
26
29
const TEST_VERSION : & str = "1.1.1" ;
27
30
28
31
pub fn update_setup ( f : & dyn Fn ( & mut Config , & Path ) ) {
@@ -304,7 +307,40 @@ info: downloading self-update
304
307
& [ "rustup" , "self" , "update" ] ,
305
308
& format ! ( " rustup updated - {version} (from {version})\n \n " , ) ,
306
309
& 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
+ } ) ;
308
344
} ) ;
309
345
}
310
346
0 commit comments