From 6c47ebc20251faadd46dc22201750f93c39851d7 Mon Sep 17 00:00:00 2001 From: Thomas Loubiou Date: Tue, 18 Jun 2024 21:45:50 +0200 Subject: [PATCH 01/12] fix: make tests pass --- examples/keyword.rs | 13 ++++++------- examples/keyword_async.rs | 4 ++-- src/config.rs | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/examples/keyword.rs b/examples/keyword.rs index 399ace7..de95be6 100644 --- a/examples/keyword.rs +++ b/examples/keyword.rs @@ -1,21 +1,20 @@ /// Demostrates how to fetch and set keywords -/// +/// /// Usage: cargo run --example keyword ? -/// Example: cargo run --example keyword decoration:rounding (prints value) +/// Example: cargo run --example keyword decoration:rounding (prints value) /// Example: cargo run --example keyword decoration:rounding 15 (sets value) - use hyprland::keyword::Keyword; fn main() -> hyprland::Result<()> { let args: Vec<_> = std::env::args().skip(1).collect(); let keyword = args[0].clone(); - + match args.len() { 0 => panic!("You need to pass a keyword"), 1 => println!("{} value is {}", keyword, Keyword::get(&keyword)?.value), - 2 => Keyword::set(keyword, args[1].clone())? - _ => panic!("Takes up to 2 arguments only!") + 2 => Keyword::set(keyword, args[1].clone())?, + _ => panic!("Takes up to 2 arguments only!"), } Ok(()) -} \ No newline at end of file +} diff --git a/examples/keyword_async.rs b/examples/keyword_async.rs index af358bc..003c87a 100644 --- a/examples/keyword_async.rs +++ b/examples/keyword_async.rs @@ -14,9 +14,9 @@ async fn main() -> hyprland::Result<()> { match args.len() { 0 => panic!("You need to pass a keyword"), 1 => println!("{} value is {}", keyword, Keyword::get_async(&keyword).await?.value), - 2 => Keyword::set_async(keyword, args[1].clone()).await? + 2 => Keyword::set_async(keyword, args[1].clone()).await?, _ => panic!("Takes up to 2 arguments only!") } Ok(()) -} \ No newline at end of file +} diff --git a/src/config.rs b/src/config.rs index 7f7b818..5103fde 100644 --- a/src/config.rs +++ b/src/config.rs @@ -248,5 +248,5 @@ fn test_binds() { Ok(v) => v, Err(e) => panic!("Error occured: {e}"), // Note to greppers: this is in a test! }; - assert_eq!(built_bind, "SUPER,v,/togglefloating"); + assert_eq!(built_bind, "SUPER,v,togglefloating"); } From 4cc5056a14abfd7a1934fb6c0c8c594b2731c5d5 Mon Sep 17 00:00:00 2001 From: Thomas Loubiou Date: Tue, 18 Jun 2024 21:51:49 +0200 Subject: [PATCH 02/12] refactor: move shared module to a folder --- src/event_listener/{shared.rs => shared/mod.rs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/event_listener/{shared.rs => shared/mod.rs} (100%) diff --git a/src/event_listener/shared.rs b/src/event_listener/shared/mod.rs similarity index 100% rename from src/event_listener/shared.rs rename to src/event_listener/shared/mod.rs From 3bda06dbd3720131efaeec149d6d80534b3e37f8 Mon Sep 17 00:00:00 2001 From: Thomas Loubiou Date: Tue, 18 Jun 2024 22:04:15 +0200 Subject: [PATCH 03/12] test: add some event parsing tests --- src/event_listener/shared/mod.rs | 7 +++++-- src/event_listener/shared/test.rs | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/event_listener/shared/test.rs diff --git a/src/event_listener/shared/mod.rs b/src/event_listener/shared/mod.rs index 84feaa5..77d400d 100644 --- a/src/event_listener/shared/mod.rs +++ b/src/event_listener/shared/mod.rs @@ -3,6 +3,9 @@ use once_cell::sync::Lazy; use regex::{Error as RegexError, Regex}; use std::{fmt::Debug, pin::Pin}; +#[cfg(test)] +mod test; + /// This trait provides shared behaviour for listener types pub(crate) trait Listener: HasExecutor { /// This method starts the event listener @@ -321,7 +324,7 @@ pub struct WindowMoveEvent { } /// The data for the event executed when opening a new window -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq)] pub struct WindowOpenEvent { /// Window address pub window_address: Address, @@ -457,7 +460,7 @@ pub struct WindowFloatEventData { } /// This enum holds every event type -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub(crate) enum Event { WorkspaceChanged(WorkspaceType), WorkspaceDeleted(WorkspaceDestroyedEventData), diff --git a/src/event_listener/shared/test.rs b/src/event_listener/shared/test.rs new file mode 100644 index 0000000..c5af944 --- /dev/null +++ b/src/event_listener/shared/test.rs @@ -0,0 +1,24 @@ +use crate::event_listener::{event_parser, Event, MonitorEventData, WorkspaceType}; + +#[test] +fn test_parsing_createworkspace() { + let events = r#"createworkspace>>2"#; + let parsed = event_parser(events.into()).unwrap(); + assert_eq!( + parsed, + vec![Event::WorkspaceAdded(WorkspaceType::Regular("2".into()))] + ) +} + +#[test] +fn test_parsing_moveworkspace() { + let events = r#"moveworkspace>>2,monitor-1"#; + let parsed = event_parser(events.into()).unwrap(); + assert_eq!( + parsed, + vec![Event::WorkspaceMoved(MonitorEventData { + monitor_name: "monitor-1".into(), + workspace: WorkspaceType::Regular("2".into()), + })] + ) +} From d826dc9f89fe215dc8946a2c3d05274c87a7dc11 Mon Sep 17 00:00:00 2001 From: Thomas Loubiou Date: Tue, 18 Jun 2024 22:36:16 +0200 Subject: [PATCH 04/12] feat: handle createworkspacev2 events --- src/event_listener/async_im.rs | 1 + src/event_listener/immutable.rs | 1 + src/event_listener/macros.rs | 1 + src/event_listener/mod.rs | 2 +- src/event_listener/shared/mod.rs | 47 +++++++++++++++++++++---------- src/event_listener/shared/test.rs | 30 +++++++++++++++++++- 6 files changed, 65 insertions(+), 17 deletions(-) diff --git a/src/event_listener/async_im.rs b/src/event_listener/async_im.rs index 0be2577..5ca8a1f 100644 --- a/src/event_listener/async_im.rs +++ b/src/event_listener/async_im.rs @@ -32,6 +32,7 @@ impl HasAsyncExecutor for AsyncEventListener { match event { Event::WorkspaceChanged(id) => arm_async!(id, workspace_changed_events, self), Event::WorkspaceAdded(id) => arm_async!(id, workspace_added_events, self), + Event::WorkspaceAddedV2(data) => arm_async!(data, workspace_added_v2_events, self), Event::WorkspaceDeleted(data) => { arm_async!(data, workspace_destroyed_events, self) } diff --git a/src/event_listener/immutable.rs b/src/event_listener/immutable.rs index 59311c5..d9f9fcb 100644 --- a/src/event_listener/immutable.rs +++ b/src/event_listener/immutable.rs @@ -31,6 +31,7 @@ impl HasExecutor for EventListener { match event { WorkspaceChanged(id) => arm!(id, workspace_changed_events, self), WorkspaceAdded(id) => arm!(id, workspace_added_events, self), + WorkspaceAddedV2(data) => arm!(data, workspace_added_v2_events, self), WorkspaceDeleted(data) => arm!(data, workspace_destroyed_events, self), WorkspaceMoved(evend) => arm!(evend, workspace_moved_events, self), WorkspaceRename(even) => arm!(even, workspace_rename_events, self), diff --git a/src/event_listener/macros.rs b/src/event_listener/macros.rs index 3601351..147823c 100644 --- a/src/event_listener/macros.rs +++ b/src/event_listener/macros.rs @@ -110,6 +110,7 @@ macro_rules! init_events { $name { workspace_changed_events: vec![], workspace_added_events: vec![], + workspace_added_v2_events: vec![], workspace_destroyed_events: vec![], workspace_moved_events: vec![], workspace_rename_events: vec![], diff --git a/src/event_listener/mod.rs b/src/event_listener/mod.rs index 57545d8..5a20e07 100644 --- a/src/event_listener/mod.rs +++ b/src/event_listener/mod.rs @@ -14,7 +14,7 @@ pub use crate::event_listener::async_im::AsyncEventListener; add_listener!(workspace_change d, WorkspaceType, "on workspace change", "changed workspace to" => id); add_listener!(workspace_added, WorkspaceType, "a workspace is created", "workspace was added" => id); -add_listener!(workspace_destroy ed, WorkspaceDestroyedEventData, "a workspace is destroyed", "a workspace was destroyed" => data); +add_listener!(workspace_destroy ed, WorkspaceV2Data, "a workspace is destroyed", "a workspace was destroyed" => data); add_listener!(workspace_moved, MonitorEventData, "a workspace is moved", "workspace was moved" => id); add_listener!(workspace_rename, WorkspaceRenameEventData, "a workspace is renamed", "workspace was renamed" => id); add_listener!(active_monitor_change d, MonitorEventData, "the active monitor is changed", "Active monitor changed to" => data); diff --git a/src/event_listener/shared/mod.rs b/src/event_listener/shared/mod.rs index 77d400d..e1a3d85 100644 --- a/src/event_listener/shared/mod.rs +++ b/src/event_listener/shared/mod.rs @@ -230,7 +230,8 @@ pub(crate) type AsyncClosures = Vec>; pub(crate) struct Events { pub(crate) workspace_changed_events: Closures, pub(crate) workspace_added_events: Closures, - pub(crate) workspace_destroyed_events: Closures, + pub(crate) workspace_added_v2_events: Closures, + pub(crate) workspace_destroyed_events: Closures, pub(crate) workspace_moved_events: Closures, pub(crate) workspace_rename_events: Closures, pub(crate) active_monitor_changed_events: Closures, @@ -256,7 +257,8 @@ pub(crate) struct Events { pub(crate) struct AsyncEvents { pub(crate) workspace_changed_events: AsyncClosures, pub(crate) workspace_added_events: AsyncClosures, - pub(crate) workspace_destroyed_events: AsyncClosures, + pub(crate) workspace_added_v2_events: AsyncClosures, + pub(crate) workspace_destroyed_events: AsyncClosures, pub(crate) workspace_moved_events: AsyncClosures, pub(crate) workspace_rename_events: AsyncClosures, pub(crate) active_monitor_changed_events: AsyncClosures, @@ -278,15 +280,6 @@ pub(crate) struct AsyncEvents { pub(crate) screencast_events: AsyncClosures, } -/// Event data for destroyworkspacev2 event -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct WorkspaceDestroyedEventData { - /// Workspace Id - pub workspace_id: WorkspaceId, - /// Workspace name - pub workspace_name: String, -} - /// Event data for renameworkspace event #[derive(Debug, Clone, PartialEq, Eq)] pub struct WorkspaceRenameEventData { @@ -459,12 +452,22 @@ pub struct WindowFloatEventData { pub is_floating: bool, } +/// This tuple struct workspacev2 creation and deletion data +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct WorkspaceV2Data { + /// Workspace Id + pub workspace_id: WorkspaceId, + /// Workspace name + pub workspace_name: WorkspaceType, +} + /// This enum holds every event type #[derive(Debug, Clone, PartialEq)] pub(crate) enum Event { WorkspaceChanged(WorkspaceType), - WorkspaceDeleted(WorkspaceDestroyedEventData), + WorkspaceDeleted(WorkspaceV2Data), WorkspaceAdded(WorkspaceType), + WorkspaceAddedV2(WorkspaceV2Data), WorkspaceMoved(MonitorEventData), WorkspaceRename(WorkspaceRenameEventData), ActiveWindowChangedV1(Option<(String, String)>), @@ -534,6 +537,7 @@ enum ParsedEventType { WorkspaceChanged, WorkspaceDeletedV2, WorkspaceAdded, + WorkspaceAddedV2, WorkspaceMoved, WorkspaceRename, ActiveWindowChangedV1, @@ -563,7 +567,7 @@ static EVENT_SET: Lazy> = Lazy::new(|| { ( ParsedEventType::WorkspaceChanged, r"\bworkspace>>(?P.*)", - ), + ), ( ParsedEventType::WorkspaceDeletedV2, r"destroyworkspacev2>>(?P.*),(?P.*)", @@ -572,6 +576,10 @@ static EVENT_SET: Lazy> = Lazy::new(|| { ParsedEventType::WorkspaceAdded, r"createworkspace>>(?P.*)", ), + ( + ParsedEventType::WorkspaceAddedV2, + r"createworkspacev2>>(?P.*),(?P.*)", + ), ( ParsedEventType::WorkspaceMoved, r"moveworkspace>>(?P.*),(?P.*)", @@ -726,11 +734,20 @@ pub(crate) fn event_parser(event: String) -> crate::Result> { }; Ok(Event::WorkspaceChanged(workspace)) } - ParsedEventType::WorkspaceDeletedV2 => Ok(Event::WorkspaceDeleted(WorkspaceDestroyedEventData { workspace_id: captures["id"].parse::().map_err(|e| HyprError::Internal(format!("Workspace delete v2: invalid integer error: {e}")))?, workspace_name: captures["name"].to_string() })), + ParsedEventType::WorkspaceDeletedV2 => Ok(Event::WorkspaceDeleted(WorkspaceV2Data { + workspace_id: captures["id"].parse::().map_err(|e| HyprError::Internal(format!("Workspace delete v2: invalid integer error: {e}")))?, + workspace_name: parse_string_as_work(captures["name"].to_string()) + })), ParsedEventType::WorkspaceAdded => Ok(Event::WorkspaceAdded(parse_string_as_work( captures["workspace"].to_string(), ))), - ParsedEventType::WorkspaceMoved => Ok(Event::WorkspaceMoved(MonitorEventData { + ParsedEventType::WorkspaceAddedV2 => Ok(Event::WorkspaceAddedV2( + WorkspaceV2Data{ + workspace_id: captures["id"].parse::().map_err(|e| HyprError::Internal(format!("Workspace delete v2: invalid integer error: {e}")))?, + workspace_name: parse_string_as_work(captures["name"].to_string()), + } + )), + ParsedEventType::WorkspaceMoved => Ok(Event::WorkspaceMoved(MonitorEventData { monitor_name: captures["monitor"].to_string(), workspace: parse_string_as_work(captures["workspace"].to_string()), })), diff --git a/src/event_listener/shared/test.rs b/src/event_listener/shared/test.rs index c5af944..73cf56b 100644 --- a/src/event_listener/shared/test.rs +++ b/src/event_listener/shared/test.rs @@ -1,4 +1,6 @@ -use crate::event_listener::{event_parser, Event, MonitorEventData, WorkspaceType}; +use crate::event_listener::{ + event_parser, Event, MonitorEventData, WorkspaceType, WorkspaceV2Data, +}; #[test] fn test_parsing_createworkspace() { @@ -22,3 +24,29 @@ fn test_parsing_moveworkspace() { })] ) } + +#[test] +fn test_parsing_createworkspacev2() { + let events = r#"createworkspacev2>>2,name-2"#; + let parsed = event_parser(events.into()).unwrap(); + assert_eq!( + parsed, + vec![Event::WorkspaceAddedV2(WorkspaceV2Data { + workspace_id: 2, + workspace_name: WorkspaceType::Regular("name-2".into()), + })] + ) +} + +#[test] +fn test_parsing_createworkspacev2_special() { + let events = r#"createworkspacev2>>-98,special:name-2"#; + let parsed = event_parser(events.into()).unwrap(); + assert_eq!( + parsed, + vec![Event::WorkspaceAddedV2(WorkspaceV2Data { + workspace_id: -98, + workspace_name: WorkspaceType::Special(Some("name-2".into())), + })] + ) +} From 801ddef0744cc0e3ed2973ea8d4a6dbc94ac1d6e Mon Sep 17 00:00:00 2001 From: Thomas Loubiou Date: Tue, 18 Jun 2024 22:46:35 +0200 Subject: [PATCH 05/12] refactor: extract function to parse workspace id --- src/event_listener/shared/mod.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/event_listener/shared/mod.rs b/src/event_listener/shared/mod.rs index e1a3d85..de03091 100644 --- a/src/event_listener/shared/mod.rs +++ b/src/event_listener/shared/mod.rs @@ -508,6 +508,14 @@ fn parse_string_as_work(str: String) -> WorkspaceType { } } +fn parse_string_as_workspace_id(id: &str) -> crate::Result { + id.parse::().map_err(|e| { + HyprError::Internal(format!( + "Cannot parse workspace id: invalid integer error: {e}" + )) + }) +} + macro_rules! report_unknown { ($event:expr) => { #[cfg(not(feature = "silent"))] @@ -735,15 +743,15 @@ pub(crate) fn event_parser(event: String) -> crate::Result> { Ok(Event::WorkspaceChanged(workspace)) } ParsedEventType::WorkspaceDeletedV2 => Ok(Event::WorkspaceDeleted(WorkspaceV2Data { - workspace_id: captures["id"].parse::().map_err(|e| HyprError::Internal(format!("Workspace delete v2: invalid integer error: {e}")))?, + workspace_id: parse_string_as_workspace_id(&captures["id"])?, workspace_name: parse_string_as_work(captures["name"].to_string()) })), ParsedEventType::WorkspaceAdded => Ok(Event::WorkspaceAdded(parse_string_as_work( captures["workspace"].to_string(), ))), ParsedEventType::WorkspaceAddedV2 => Ok(Event::WorkspaceAddedV2( - WorkspaceV2Data{ - workspace_id: captures["id"].parse::().map_err(|e| HyprError::Internal(format!("Workspace delete v2: invalid integer error: {e}")))?, + WorkspaceV2Data { + workspace_id: parse_string_as_workspace_id(&captures["id"])?, workspace_name: parse_string_as_work(captures["name"].to_string()), } )), From 9128b7909ee7c6d8f36ee160a3d3834f846d7ffc Mon Sep 17 00:00:00 2001 From: Thomas Loubiou Date: Tue, 18 Jun 2024 22:51:17 +0200 Subject: [PATCH 06/12] test: renameworkspace event parsing --- src/event_listener/shared/test.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/event_listener/shared/test.rs b/src/event_listener/shared/test.rs index 73cf56b..c1d48e1 100644 --- a/src/event_listener/shared/test.rs +++ b/src/event_listener/shared/test.rs @@ -1,5 +1,5 @@ use crate::event_listener::{ - event_parser, Event, MonitorEventData, WorkspaceType, WorkspaceV2Data, + event_parser, Event, MonitorEventData, WorkspaceRenameEventData, WorkspaceType, WorkspaceV2Data, }; #[test] @@ -50,3 +50,16 @@ fn test_parsing_createworkspacev2_special() { })] ) } + +#[test] +fn test_parsing_workspacerename() { + let events = r#"renameworkspace>>3,new name"#; + let parsed = event_parser(events.into()).unwrap(); + assert_eq!( + parsed, + vec![Event::WorkspaceRename(WorkspaceRenameEventData { + workspace_id: 3, + workspace_name: "new name".into(), + })] + ) +} From 351ea401deaf40e6f05b2fc582e1abe9acf79724 Mon Sep 17 00:00:00 2001 From: Thomas Loubiou Date: Tue, 18 Jun 2024 22:51:28 +0200 Subject: [PATCH 07/12] refactor: use new parsing method for workspace id --- src/event_listener/shared/mod.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/event_listener/shared/mod.rs b/src/event_listener/shared/mod.rs index de03091..6d248bc 100644 --- a/src/event_listener/shared/mod.rs +++ b/src/event_listener/shared/mod.rs @@ -761,9 +761,7 @@ pub(crate) fn event_parser(event: String) -> crate::Result> { })), ParsedEventType::WorkspaceRename => { Ok(Event::WorkspaceRename(WorkspaceRenameEventData { - workspace_id: captures["id"] - .parse::() - .map_err(|e| HyprError::Internal(format!("Workspace rename: invalid integer error: {e}")))?, + workspace_id: parse_string_as_workspace_id(&captures["id"])?, workspace_name: captures["name"].to_string(), })) } From 79b2905b2e3413e33d7ca8a2a2537767528f3a25 Mon Sep 17 00:00:00 2001 From: Thomas Loubiou Date: Tue, 18 Jun 2024 22:55:29 +0200 Subject: [PATCH 08/12] test: destroyworkspacev2 parsing --- src/event_listener/shared/test.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/event_listener/shared/test.rs b/src/event_listener/shared/test.rs index c1d48e1..8d4cc10 100644 --- a/src/event_listener/shared/test.rs +++ b/src/event_listener/shared/test.rs @@ -38,6 +38,19 @@ fn test_parsing_createworkspacev2() { ) } +#[test] +fn test_parsing_destroyworkspacev2() { + let events = r#"destroyworkspacev2>>2,name-2"#; + let parsed = event_parser(events.into()).unwrap(); + assert_eq!( + parsed, + vec![Event::WorkspaceDeleted(WorkspaceV2Data { + workspace_id: 2, + workspace_name: WorkspaceType::Regular("name-2".into()), + })] + ) +} + #[test] fn test_parsing_createworkspacev2_special() { let events = r#"createworkspacev2>>-98,special:name-2"#; From a0d5d79a5b03a19bc1c87cfd5940e1aa9937779d Mon Sep 17 00:00:00 2001 From: Thomas Loubiou Date: Tue, 18 Jun 2024 22:58:21 +0200 Subject: [PATCH 09/12] test: add error case and multiple events case --- src/event_listener/shared/test.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/event_listener/shared/test.rs b/src/event_listener/shared/test.rs index 8d4cc10..f547a88 100644 --- a/src/event_listener/shared/test.rs +++ b/src/event_listener/shared/test.rs @@ -2,6 +2,13 @@ use crate::event_listener::{ event_parser, Event, MonitorEventData, WorkspaceRenameEventData, WorkspaceType, WorkspaceV2Data, }; +#[test] +fn test_parsing_unknown_event() { + let events = r#"unknowevent>>2"#; + let parsed = event_parser(events.into()).unwrap(); + assert_eq!(parsed, vec![]) +} + #[test] fn test_parsing_createworkspace() { let events = r#"createworkspace>>2"#; @@ -76,3 +83,21 @@ fn test_parsing_workspacerename() { })] ) } + +#[test] +fn test_parsing_multiple_events() { + let events = r#"createworkspace>>2 +createworkspacev2>>2,named 2 +"#; + let parsed = event_parser(events.into()).unwrap(); + assert_eq!( + parsed, + vec![ + Event::WorkspaceAdded(WorkspaceType::Regular("2".into())), + Event::WorkspaceAddedV2(WorkspaceV2Data { + workspace_id: 2, + workspace_name: WorkspaceType::Regular("named 2".into()), + }), + ] + ) +} From c4ad66024c5196ffded9ecccee55c59b84a3350c Mon Sep 17 00:00:00 2001 From: Thomas Loubiou Date: Tue, 18 Jun 2024 23:03:04 +0200 Subject: [PATCH 10/12] test: bad workspace id --- src/event_listener/shared/test.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/event_listener/shared/test.rs b/src/event_listener/shared/test.rs index f547a88..3ec7c46 100644 --- a/src/event_listener/shared/test.rs +++ b/src/event_listener/shared/test.rs @@ -9,6 +9,17 @@ fn test_parsing_unknown_event() { assert_eq!(parsed, vec![]) } +#[test] +fn test_parsing_bad_id() { + let events = r#"createworkspacev2>>NOT_A_NUMBER,name"#; + let error = event_parser(events.into()).err(); + assert!(error.is_some()); + assert_eq!( + format!("{}", error.unwrap()), + "Cannot parse workspace id: invalid integer error: invalid digit found in string" + ) +} + #[test] fn test_parsing_createworkspace() { let events = r#"createworkspace>>2"#; From 2167c44d2eacf63b566a9a2da4c84f4c3a4d01ae Mon Sep 17 00:00:00 2001 From: Thomas Loubiou Date: Tue, 18 Jun 2024 23:04:39 +0200 Subject: [PATCH 11/12] docs: not a tuple --- src/event_listener/shared/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/event_listener/shared/mod.rs b/src/event_listener/shared/mod.rs index 6d248bc..d65b559 100644 --- a/src/event_listener/shared/mod.rs +++ b/src/event_listener/shared/mod.rs @@ -452,7 +452,7 @@ pub struct WindowFloatEventData { pub is_floating: bool, } -/// This tuple struct workspacev2 creation and deletion data +/// This struct workspacev2 creation and deletion data #[derive(Debug, Clone, PartialEq, Eq)] pub struct WorkspaceV2Data { /// Workspace Id From 7fe4ced7bef44c529e601c72b876029ead11c48a Mon Sep 17 00:00:00 2001 From: Thomas Loubiou Date: Tue, 18 Jun 2024 23:08:34 +0200 Subject: [PATCH 12/12] refactor: rename test file --- src/event_listener/shared/{test.rs => event_parsing_test.rs} | 0 src/event_listener/shared/mod.rs | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename src/event_listener/shared/{test.rs => event_parsing_test.rs} (100%) diff --git a/src/event_listener/shared/test.rs b/src/event_listener/shared/event_parsing_test.rs similarity index 100% rename from src/event_listener/shared/test.rs rename to src/event_listener/shared/event_parsing_test.rs diff --git a/src/event_listener/shared/mod.rs b/src/event_listener/shared/mod.rs index d65b559..7527173 100644 --- a/src/event_listener/shared/mod.rs +++ b/src/event_listener/shared/mod.rs @@ -4,7 +4,7 @@ use regex::{Error as RegexError, Regex}; use std::{fmt::Debug, pin::Pin}; #[cfg(test)] -mod test; +mod event_parsing_test; /// This trait provides shared behaviour for listener types pub(crate) trait Listener: HasExecutor {