From 17e64ce9f0781a88a7f372f194136a75b2685708 Mon Sep 17 00:00:00 2001 From: hbere Date: Wed, 30 Oct 2024 03:30:34 +0100 Subject: [PATCH] minor changes - added some comments - changed behaviour of rofi moving window to new workspace --- Cargo.lock | 90 ---------- Cargo.toml | 1 - src/ipcadapter.rs | 160 ++++++++++-------- src/lib.rs | 4 +- src/workspaces.rs | 85 +++++++++- tests/common/mod.rs | 2 +- .../integration_test_container_operations.rs | 2 +- tests/integration_test_rofi_actions.rs | 19 ++- .../integration_test_workspace_operations.rs | 18 +- 9 files changed, 196 insertions(+), 185 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5f7998f..8ab86ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,101 +11,18 @@ dependencies = [ "memchr", ] -[[package]] -name = "anstyle" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "downcast" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" - -[[package]] -name = "fragile" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" - [[package]] name = "itoa" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - [[package]] name = "memchr" version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" -[[package]] -name = "mockall" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43766c2b5203b10de348ffe19f7e54564b64f3d6018ff7648d1e2d6d3a0f0a48" -dependencies = [ - "cfg-if", - "downcast", - "fragile", - "lazy_static", - "mockall_derive", - "predicates", - "predicates-tree", -] - -[[package]] -name = "mockall_derive" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cbce79ec385a1d4f54baa90a76401eb15d9cab93685f62e7e9f942aa00ae2" -dependencies = [ - "cfg-if", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "predicates" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8" -dependencies = [ - "anstyle", - "predicates-core", -] - -[[package]] -name = "predicates-core" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" - -[[package]] -name = "predicates-tree" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" -dependencies = [ - "predicates-core", - "termtree", -] - [[package]] name = "proc-macro2" version = "1.0.84" @@ -216,7 +133,6 @@ dependencies = [ name = "swaymsg_workspace" version = "0.1.0" dependencies = [ - "mockall", "regex", "swayipc", ] @@ -232,12 +148,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "termtree" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" - [[package]] name = "thiserror" version = "1.0.61" diff --git a/Cargo.toml b/Cargo.toml index af1e7b0..0a35f09 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,5 @@ version = "0.1.0" edition = "2021" [dependencies] -mockall = "0.12.1" regex = "1.10.4" swayipc = "3.0.2" diff --git a/src/ipcadapter.rs b/src/ipcadapter.rs index c38061a..9bd6600 100644 --- a/src/ipcadapter.rs +++ b/src/ipcadapter.rs @@ -2,27 +2,26 @@ use core::fmt::Debug; use std::any::Any; use std::cell::RefCell; use std::error::Error; +use std::fmt; use std::rc::Rc; -//////////////////////////////////////////////////////////////////////////////// -// INTERFACES -//////////////////////////////////////////////////////////////////////////////// - pub type IpcResult = Result, Box>; -use std::fmt; - #[derive(Debug)] pub struct IpcError { pub command: String, } - +impl Error for IpcError {} impl fmt::Display for IpcError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "Command {} failed", self.command) } } +//////////////////////////////////////////////////////////////////////////////// +// INTERFACES +//////////////////////////////////////////////////////////////////////////////// + pub trait ConnectionProxy { fn run_command(&mut self, payload: String) -> IpcResult; fn as_any(&self) -> &dyn Any; @@ -70,14 +69,12 @@ impl Debug for dyn OutputProxy { pub trait IPCAdapter { /// - /// asdfasdfasfdafdsasdf + /// Provides Workspaces, Outputs, as well as a connection from/to sway /// - /// # Examples - /// - /// ``` - /// # #![allow(unused_mut)] - /// ``` fn new() -> impl IPCAdapter; + /// + /// Breaks up ipcAdapter into objects and passing on ownership of those + /// fn explode( self, ) -> ( @@ -88,9 +85,21 @@ pub trait IPCAdapter { } //////////////////////////////////////////////////////////////////////////////// -// TESTING IMPLEMENTATION +// # TESTING IMPLEMENTATION //////////////////////////////////////////////////////////////////////////////// - +/// +/// Connection implementation for testing +/// +/// # Examples +/// +/// ``` +/// use std::rc::Rc; +/// use swaymsg_workspace::ipcadapter::MockConnection; +/// +/// let mockconnection = MockConnection { +/// commandhistory: Rc::new(vec![].into()), +/// }; +/// ``` #[derive(Debug)] pub struct MockConnection { pub commandhistory: Rc>>, @@ -106,6 +115,21 @@ impl ConnectionProxy for MockConnection { } } +/// +/// Workspace implementation for testing +/// +/// # Examples +/// +/// ``` +/// use swaymsg_workspace::ipcadapter::MockWorkspace; +/// +/// let mockworkspace = MockWorkspace { +/// num: Some(1), +/// name: "Foo".to_string(), +/// output: "eDP-1".to_string(), +/// focused: true, +/// }; +/// ``` #[derive(Debug)] pub struct MockWorkspace { pub num: Option, @@ -129,6 +153,19 @@ impl WorkspaceProxy for MockWorkspace { } } +/// +/// Output implementation for testing +/// +/// # Examples +/// +/// ``` +/// use swaymsg_workspace::ipcadapter::MockOutput; +/// +/// let mockoutput = MockOutput { +/// name: "eDP-1".to_string(), +/// focused: true, +/// }; +/// ``` #[derive(Debug)] pub struct MockOutput { pub name: String, @@ -149,7 +186,23 @@ pub struct MockIPCAdapter { pub outputs: Vec>, } +/// +/// IPCAdapter implementation for testing +/// +/// # Examples +/// +/// ``` +/// use swaymsg_workspace::ipcadapter::MockIPCAdapter; +/// use crate::swaymsg_workspace::ipcadapter::IPCAdapter; +/// +/// let mockipcadapter = MockIPCAdapter::new(); +/// ``` impl IPCAdapter for MockIPCAdapter { + /// + /// ### constructs a basic mocked environment: + /// - 2 Workspaces "Foo" and "Bar" + /// - 1 Output "eDP-1" + /// fn new() -> impl IPCAdapter { MockIPCAdapter { connection: RefCell::new(Box::new(MockConnection { @@ -160,7 +213,7 @@ impl IPCAdapter for MockIPCAdapter { num: Some(1), name: "Foo".to_string(), output: "eDP-1".to_string(), - focused: false, + focused: true, }), Box::new(MockWorkspace { num: Some(2), @@ -168,65 +221,26 @@ impl IPCAdapter for MockIPCAdapter { output: "eDP-1".to_string(), focused: false, }), - Box::new(MockWorkspace { - num: Some(3), - name: "Bar".to_string(), - output: "eDP-1".to_string(), - focused: false, - }), - Box::new(MockWorkspace { - num: Some(3), - name: "Bar".to_string(), - output: "HDMI-1".to_string(), - focused: false, - }), - Box::new(MockWorkspace { - num: None, - name: "Span2".to_string(), - output: "eDP-1".to_string(), - focused: false, - }), - Box::new(MockWorkspace { - num: None, - name: "Span2".to_string(), - output: "HDMI-1".to_string(), - focused: false, - }), - Box::new(MockWorkspace { - num: None, - name: "Span3".to_string(), - output: "eDP-1".to_string(), - focused: true, - }), - Box::new(MockWorkspace { - num: None, - name: "Span3".to_string(), - output: "HDMI-1".to_string(), - focused: false, - }), - Box::new(MockWorkspace { - num: None, - name: "Span3".to_string(), - output: "HDMI-2".to_string(), - focused: true, - }), - ], - outputs: vec![ - Box::new(MockOutput { - focused: false, - name: "eDP-1".to_string(), - }), - Box::new(MockOutput { - focused: true, - name: "HDMI-1".to_string(), - }), - Box::new(MockOutput { - focused: false, - name: "HDMI-2".to_string(), - }), ], + outputs: vec![Box::new(MockOutput { + focused: true, + name: "eDP-1".to_string(), + })], } } + + /// + /// Breaks up ipcAdapter into objects and passing on ownership of those + /// + /// # Examples + /// + /// ``` + /// use swaymsg_workspace::ipcadapter::MockIPCAdapter; + /// use crate::swaymsg_workspace::ipcadapter::IPCAdapter; + /// + /// let ipcadapter = MockIPCAdapter::new(); + /// let (connection, ipcworkspaces, ipcoutputs) = ipcadapter.explode(); + /// ``` fn explode( self, ) -> ( @@ -239,7 +253,7 @@ impl IPCAdapter for MockIPCAdapter { } //////////////////////////////////////////////////////////////////////////////// -// PROD IMPLEMENTATION +// # PROD IMPLEMENTATION //////////////////////////////////////////////////////////////////////////////// #[derive(Debug)] diff --git a/src/lib.rs b/src/lib.rs index fcfc904..6a3046b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,7 @@ use core::panic; use ipcadapter::IpcResult; use std::rc::Rc; use workspaces::extract_starting_number; -use workspaces::find_free_workspace_num; +use workspaces::find_free_adjecent_workspace_num; use workspaces::Workspace; use workspaces::Workspaces; pub mod ipcadapter; @@ -166,7 +166,7 @@ pub fn execute_userinput( Some(_number) => workspaces.move_container_to(&workspacename), None => workspaces.move_container_to(&format!( "{} {}", - find_free_workspace_num(&workspaces.on_same_screen()), + find_free_adjecent_workspace_num(&workspaces.on_same_screen()), &workspacename )), }, diff --git a/src/workspaces.rs b/src/workspaces.rs index b65282f..27db1fe 100644 --- a/src/workspaces.rs +++ b/src/workspaces.rs @@ -1,4 +1,4 @@ -use regex::{Error, Regex}; +use regex::Regex; use std::cmp::Ordering; use std::ops::Deref; use std::{ @@ -8,6 +8,12 @@ use std::{ use crate::ipcadapter::{ConnectionProxy, IPCAdapter, IpcResult, OutputProxy, WorkspaceProxy}; +//////////////////////////////////////////////////////////////////////////////// +// # Custom Vector for Workspaces +//////////////////////////////////////////////////////////////////////////////// +/// +/// Workspace conscious Vector featuring convenience methods +/// #[derive(Debug)] pub struct VecOfWorkspaces { items: Vec>, @@ -66,7 +72,7 @@ impl VecOfWorkspaces { } } } - pub fn focused(&self) -> Option<&Workspace> { + pub fn get_focused(&self) -> Option<&Workspace> { match &self.focused { Some(rc) => Some(&*rc), None => None, @@ -96,6 +102,12 @@ impl VecOfWorkspaces { } } +//////////////////////////////////////////////////////////////////////////////// +// # Custom Workspaces +//////////////////////////////////////////////////////////////////////////////// +/// +/// +/// #[derive(Debug)] pub struct Workspace { number: RefCell>, @@ -115,8 +127,11 @@ pub struct Workspaces { } impl Workspace { + /// + /// returns the name if present + /// otherwise extracts the name from the basename + /// pub fn get_name(&self) -> String { - self.find_free_workspace_num(); let name = &mut *self.name.borrow_mut(); match name { Some(name) => name.clone(), @@ -130,6 +145,10 @@ impl Workspace { } } + /// + /// returns the workspacenumber if present + /// otherwise extracts the workspacenumber from the basename + /// pub fn get_number(&self) -> usize { let number = &mut *self.number.borrow_mut(); match number { @@ -144,14 +163,24 @@ impl Workspace { } } + /// + /// hard rename + /// pub fn rename(&self, to: &str) -> IpcResult { self.workspaces().rename(&self.basename, to) } + /// + /// convenience wrapper for extract name/number and validate name/number + /// fn slice_basename<'a>(&'a self) -> (usize, &'a str) { self.cast_and_validate_fragments(self.extract_fragments(&self.basename)) } + /// + /// always returns a valid workspacenumber and name + /// if no number is present use a new unused workspacenumber + /// fn cast_and_validate_fragments<'a>( &'a self, fragments: (&'a str, &'a str), @@ -165,6 +194,9 @@ impl Workspace { (number, name) } + /// + /// takes a basename and splits the number from the name + /// fn extract_fragments<'a>(&self, wsname: &'a str) -> (&'a str, &'a str) { let capture_number_and_name = Regex::new(r"^(?\d*)\s*(?.*)").unwrap(); let caps = capture_number_and_name.captures(&wsname).unwrap(); @@ -181,6 +213,9 @@ impl Workspace { } } +/// +/// get the next unused workspace number from all passed workspaces +/// pub fn find_free_workspace_num(workspaces: &VecOfWorkspaces) -> usize { workspaces .iter() @@ -191,6 +226,50 @@ pub fn find_free_workspace_num(workspaces: &VecOfWorkspaces) -> usize { + 1 // remember, we want the next free number } +/// +/// get the next unused workspace number from orkspaces right of the focused one +/// +pub fn find_free_adjecent_workspace_num(workspaces: &VecOfWorkspaces) -> usize { + let start = index_of_focused_workspace(workspaces); + let startnumber = workspaces + .get_focused() + .and_then(|focused| extract_starting_number(&focused.basename)) + .unwrap_or_default(); + + let mut workspaces_right_of_current_number = workspaces.split_at(start).1.iter(); + for trynumber in startnumber..=100 { + if let Some(adjecent_workspace_number) = workspaces_right_of_current_number + .next() + .map(|workspace| extract_starting_number(&workspace.basename)) + .and_then(|num| num) + { + // adjecent workspace to the right has a number, see if it collides with the number the new workspace would get + if trynumber < adjecent_workspace_number { + return trynumber; + } + } else { + // adjecent workspace it not numbered, so we can assume our number is not used yet. + return trynumber; + } + } + find_free_workspace_num(workspaces) // if by some miracle there are more than 100 workspaces fall back to getting the last number + 1 +} + +/// +/// +/// +pub fn index_of_focused_workspace(workspaces: &VecOfWorkspaces) -> usize { + workspaces + .get_focused() + .and_then(|focused| { + workspaces + .iter() + .position(|iter| iter.basename == focused.basename) + .take() + }) + .unwrap_or_default() +} + pub fn extract_starting_number(source: &str) -> Option { if let Ok(capture_starting_number) = Regex::new(r"^(?P(\d*)).*") { if let Some(caps) = capture_starting_number.captures(source) { diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 08e7d4f..464ec8a 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -5,7 +5,7 @@ use swaymsg_workspace::{ workspaces::Workspaces, }; -pub fn setup_4workspaces_across_3outputs() -> (Rc, Rc>>) { +pub fn setup_4_workspaces_across_3_outputs() -> (Rc, Rc>>) { let commands = Rc::new(RefCell::new(vec![])); let connection: RefCell> = RefCell::new(Box::new(MockConnection { commandhistory: commands.clone(), diff --git a/tests/integration_test_container_operations.rs b/tests/integration_test_container_operations.rs index 97390d9..af14ba4 100644 --- a/tests/integration_test_container_operations.rs +++ b/tests/integration_test_container_operations.rs @@ -2,7 +2,7 @@ mod common; #[test] fn test_moving_container() { - let (workspaces, commandhistory) = common::setup_4workspaces_across_3outputs(); + let (workspaces, commandhistory) = common::setup_4_workspaces_across_3_outputs(); let result = swaymsg_workspace::execute_userinput( workspaces, String::from("move_container_to_workspace_number"), diff --git a/tests/integration_test_rofi_actions.rs b/tests/integration_test_rofi_actions.rs index 2472c6f..4ddd9ad 100644 --- a/tests/integration_test_rofi_actions.rs +++ b/tests/integration_test_rofi_actions.rs @@ -1,16 +1,19 @@ mod common; #[test] -fn test_moving_windows_via_rofi() { +fn test_rofi_move_window_() { // missing 'to' parameter - let (workspaces, commandhistory) = common::setup_4workspaces_across_3outputs(); + let (workspaces, commandhistory) = common::setup_4_workspaces_across_3_outputs(); let result = swaymsg_workspace::execute_userinput(workspaces, String::from("rofi_move_window"), None); assert_eq!(result.ok().unwrap().concat(), "nonipc: rofi_move_window"); assert_eq!(commandhistory.take().concat(), ""); +} +#[test] +fn test_rofi_move_window_1_foo() { // move window to existing Foo - let (workspaces, commandhistory) = common::setup_4workspaces_across_3outputs(); + let (workspaces, commandhistory) = common::setup_4_workspaces_across_3_outputs(); let result = swaymsg_workspace::execute_userinput( workspaces, String::from("rofi_move_window"), @@ -19,9 +22,12 @@ fn test_moving_windows_via_rofi() { let expected = "move window to workspace '1 Foo'"; assert_eq!(&result.ok().unwrap().join(" | "), &expected); assert_eq!(&commandhistory.take().join(" | "), &expected); +} +#[test] +fn test_rofi_move_window_foo() { // move window to new workspace with a shared name but different basename (Foo's already taken by 1) - let (workspaces, commandhistory) = common::setup_4workspaces_across_3outputs(); + let (workspaces, commandhistory) = common::setup_4_workspaces_across_3_outputs(); let result = swaymsg_workspace::execute_userinput( workspaces, String::from("rofi_move_window"), @@ -30,9 +36,12 @@ fn test_moving_windows_via_rofi() { let expected = "move window to workspace '3 Foo'"; assert_eq!(&result.ok().unwrap().join(" | "), &expected); assert_eq!(&commandhistory.take().join(" | "), &expected); +} +#[test] +fn test_rofi_move_window_idonotexistyet() { // move window to non existing IDONOTEXISTYET - let (workspaces, commandhistory) = common::setup_4workspaces_across_3outputs(); + let (workspaces, commandhistory) = common::setup_4_workspaces_across_3_outputs(); let result = swaymsg_workspace::execute_userinput( workspaces, String::from("rofi_move_window"), diff --git a/tests/integration_test_workspace_operations.rs b/tests/integration_test_workspace_operations.rs index a9c54fa..887f2e5 100644 --- a/tests/integration_test_workspace_operations.rs +++ b/tests/integration_test_workspace_operations.rs @@ -3,21 +3,21 @@ mod common; #[test] fn test_selecting_workspace() { // select next workspace on same screen - let (workspaces, commandhistory) = common::setup_4workspaces_across_3outputs(); + let (workspaces, commandhistory) = common::setup_4_workspaces_across_3_outputs(); let result = swaymsg_workspace::execute_userinput(workspaces, String::from("next"), None); let expected = "workspace '1 Foo'"; assert_eq!(&result.ok().unwrap().join(" | "), &expected); assert_eq!(&commandhistory.take().join(" | "), &expected); // select next workspace on same screen (wrap to start) - let (workspaces, commandhistory) = common::setup_4workspaces_across_3outputs(); + let (workspaces, commandhistory) = common::setup_4_workspaces_across_3_outputs(); let result = swaymsg_workspace::execute_userinput(workspaces, String::from("prev"), None); let expected = "workspace '1 Foo'"; assert_eq!(&result.ok().unwrap().join(" | "), &expected); assert_eq!(&commandhistory.take().join(" | "), &expected); // select next workspace on same screen (wrap to start) - let (workspaces, commandhistory) = common::setup_4workspaces_across_3outputs(); + let (workspaces, commandhistory) = common::setup_4_workspaces_across_3_outputs(); let result = swaymsg_workspace::execute_userinput( workspaces, String::from("number"), @@ -30,14 +30,14 @@ fn test_selecting_workspace() { #[test] fn test_moving_workspace() { - let (workspaces, commandhistory) = common::setup_4workspaces_across_3outputs(); + let (workspaces, commandhistory) = common::setup_4_workspaces_across_3_outputs(); let result = swaymsg_workspace::execute_userinput(workspaces, String::from("swap_with_next"), None); let expected = "rename workspace '2 Bar' to '1 Bar\u{200b}' | rename workspace '1 Foo' to '2 Foo' | rename workspace '1 Bar\u{200b}' to '1 Bar'"; assert_eq!(&result.ok().unwrap().join(" | "), &expected); assert_eq!(&commandhistory.take().join(" | "), &expected); - let (workspaces, commandhistory) = common::setup_4workspaces_across_3outputs(); + let (workspaces, commandhistory) = common::setup_4_workspaces_across_3_outputs(); let result = swaymsg_workspace::execute_userinput(workspaces, String::from("swap_with_prev"), None); let expected = "rename workspace '1 Foo' to '2 Foo' | rename workspace '2 Bar' to '1 Bar\u{200b}' | rename workspace '1 Bar\u{200b}' to '1 Bar'"; @@ -48,14 +48,14 @@ fn test_moving_workspace() { #[test] fn test_reindexing_workspace() { // reindex to a free workspace number - let (workspaces, commandhistory) = common::setup_4workspaces_across_3outputs(); + let (workspaces, commandhistory) = common::setup_4_workspaces_across_3_outputs(); let result = swaymsg_workspace::execute_userinput(workspaces, String::from("increase"), None); let expected = "rename workspace '2 Bar' to '3 Bar'"; assert_eq!(&result.ok().unwrap().join(" | "), &expected); assert_eq!(&commandhistory.take().join(" | "), &expected); // reindex to a already taken workspace number - let (workspaces, commandhistory) = common::setup_4workspaces_across_3outputs(); + let (workspaces, commandhistory) = common::setup_4_workspaces_across_3_outputs(); let result = swaymsg_workspace::execute_userinput(workspaces, String::from("decrease"), None); let expected = "rename workspace '1 Foo' to '2 Foo' | rename workspace '2 Bar' to '1 Bar\u{200b}' | rename workspace '1 Bar\u{200b}' to '1 Bar'"; assert_eq!(&result.ok().unwrap().join(" | "), &expected); @@ -65,7 +65,7 @@ fn test_reindexing_workspace() { #[test] fn test_renaming_workspace() { // rename to non existent name Baz - let (workspaces, commandhistory) = common::setup_4workspaces_across_3outputs(); + let (workspaces, commandhistory) = common::setup_4_workspaces_across_3_outputs(); let result = swaymsg_workspace::execute_userinput( workspaces, String::from("rename_to"), @@ -76,7 +76,7 @@ fn test_renaming_workspace() { assert_eq!(&commandhistory.take().join(" | "), &expected); // rename to existing name Foo - let (workspaces, commandhistory) = common::setup_4workspaces_across_3outputs(); + let (workspaces, commandhistory) = common::setup_4_workspaces_across_3_outputs(); let result = swaymsg_workspace::execute_userinput( workspaces, String::from("rename_to"),