diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-08-18 22:39:38 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-08-18 22:39:38 +0300 |
| commit | 9fac51722653fa0b0b6a5786166fb18c763424e0 (patch) | |
| tree | a8efd3b30cf29a8fb11138b7444bb9baa0dac2fa /src/config/model.rs | |
| parent | 0bd445020ea19e0cea13f42a28212db7b2df196d (diff) | |
feat: make Windows generally available
Diffstat (limited to 'src/config/model.rs')
| -rw-r--r-- | src/config/model.rs | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/config/model.rs b/src/config/model.rs index ad779d26..c10cd733 100644 --- a/src/config/model.rs +++ b/src/config/model.rs @@ -47,7 +47,11 @@ impl Default for UpdateConfig { } fn default_update_channel() -> UpdateChannelConfig { - if cfg!(windows) { + default_update_channel_for_build(cfg!(windows), crate::build_info::is_preview()) +} + +fn default_update_channel_for_build(is_windows: bool, is_preview: bool) -> UpdateChannelConfig { + if is_windows && is_preview { UpdateChannelConfig::Preview } else { UpdateChannelConfig::Stable @@ -1251,21 +1255,33 @@ manifest_check = false assert!(!config.update.manifest_check); } - #[cfg(windows)] #[test] - fn windows_update_config_defaults_to_preview() { + fn update_channel_default_follows_windows_build_identity() { + assert_eq!( + default_update_channel_for_build(true, true), + UpdateChannelConfig::Preview + ); + assert_eq!( + default_update_channel_for_build(true, false), + UpdateChannelConfig::Stable + ); + assert_eq!( + default_update_channel_for_build(false, true), + UpdateChannelConfig::Stable + ); + } + + #[test] + fn missing_update_channel_uses_build_default() { let empty: Config = toml::from_str("").unwrap(); let without_update_channel: Config = toml::from_str("[update]\nversion_check = false").unwrap(); - assert_eq!( - Config::default().update.channel, - UpdateChannelConfig::Preview - ); - assert_eq!(empty.update.channel, UpdateChannelConfig::Preview); + assert_eq!(Config::default().update.channel, default_update_channel()); + assert_eq!(empty.update.channel, default_update_channel()); assert_eq!( without_update_channel.update.channel, - UpdateChannelConfig::Preview + default_update_channel() ); } |
