Skip to content

Commit 10de7be

Browse files
author
erik
committed
chore: apply local CodeRabbit review nits
Remove redundant debian/install entry handled by data/justfile, add parse_launcher_action unit tests, and fix window_switcher config EOF.
1 parent 3feeb97 commit 10de7be

2 files changed

Lines changed: 45 additions & 1 deletion

File tree

debian/install

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33
/usr/share/icons/hicolor/scalable/apps/com.system76.CosmicLauncher.svg
44
/usr/share/icons/hicolor/symbolic/apps/com.system76.CosmicLauncher-symbolic.svg
55
/usr/share/metainfo/com.system76.CosmicLauncher.metainfo.xml
6-
data/cosmic/com.system76.CosmicLauncher/v1/window_switcher

src/app.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,51 @@ impl FromStr for LauncherTasks {
155155
}
156156
}
157157

158+
#[cfg(test)]
159+
mod tests {
160+
use super::*;
161+
162+
#[test]
163+
fn parse_launcher_action_accepts_kebab_case() {
164+
assert!(matches!(
165+
parse_launcher_action("alt-tab-workspace", &[]),
166+
Ok(LauncherTasks::AltTabWorkspace)
167+
));
168+
}
169+
170+
#[test]
171+
fn parse_launcher_action_accepts_json_variant() {
172+
assert!(matches!(
173+
parse_launcher_action("\"AltTabAll\"", &[]),
174+
Ok(LauncherTasks::AltTabAll)
175+
));
176+
}
177+
178+
#[test]
179+
fn parse_launcher_action_accepts_input_with_args() {
180+
let cmd = parse_launcher_action("Input", &["firefox".into()]).unwrap();
181+
assert!(matches!(
182+
cmd,
183+
LauncherTasks::Input {
184+
input: Some(ref value)
185+
} if value == "firefox"
186+
));
187+
}
188+
189+
#[test]
190+
fn workspace_filter_maps_alt_tab_to_config_default() {
191+
let config = WindowSwitcher::default();
192+
assert_eq!(
193+
LauncherTasks::AltTab.workspace_filter(&config),
194+
WorkspaceFilter::All
195+
);
196+
assert_eq!(
197+
LauncherTasks::AltTabWorkspace.workspace_filter(&config),
198+
WorkspaceFilter::Current
199+
);
200+
}
201+
}
202+
158203
impl CosmicFlags for Args {
159204
type SubCommand = LauncherTasks;
160205
type Args = Vec<String>;

0 commit comments

Comments
 (0)