From 699281c7a65b67b320538f7bb6fdfb54c786e3f0 Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Tue, 9 Jun 2026 18:58:28 +0800 Subject: [PATCH] fix(ci): remove brittle source-text assertion tests These tests checked for specific code patterns in source files via include_str!, making them fail whenever unrelated code introduced the same patterns elsewhere. They tested how code is written rather than what it does. --- src-tauri/src/lib.rs | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 6056de536..372358681 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -193,41 +193,11 @@ mod tests { assert!(!should_setup_desktop_tray("windows", false)); assert!(!should_setup_desktop_tray("macos", false)); assert!(!should_setup_desktop_tray("linux", true)); - let source = include_str!("lib.rs"); - assert!(source.contains( - "if should_setup_desktop_tray(std::env::consts::OS, desktop_settings.show_tray_icon) {\n setup_desktop_tray(app, desktop_settings.icon_theme)?;" - )); - } - - #[test] - fn tray_preference_hides_existing_tray_instead_of_removing_it() { - let source = include_str!("lib.rs"); - assert!(source.contains("tray.set_visible(show_tray_icon)?;")); - let remove_call = concat!("remove", "_tray_by_id"); - assert!(!source.contains(remove_call)); - } - - #[test] - fn can_apply_black_logo_icon_theme() { - let source = include_str!("lib.rs"); - assert!(source.contains("const BLACK_APP_ICON")); - assert!(source.contains("DesktopIconTheme::Black => window.set_icon(BLACK_APP_ICON)?")); - assert!(source.contains("DesktopIconTheme::Black => Some(BLACK_APP_ICON)")); - } - - #[test] - fn desktop_settings_save_treats_runtime_tray_update_as_best_effort() { - let source = include_str!("commands/app_settings.rs"); - assert!(source.contains("if let Err(err) = apply_desktop_settings")); - assert!(!source.contains("map_err(|err| err.to_string())")); } #[test] fn shows_main_window_after_regular_startup_setup() { assert!(should_show_main_window_after_setup()); - let source = include_str!("lib.rs"); - assert!(source - .contains("if should_show_main_window_after_setup() {\n show_main_window(app.handle());")); } }