test(workspace): move window to non existent container

Created a test for moving a window to a container that doesn't exist.
The test ensures that we receive an error when moving a window to a
container that doesn't exist.
This commit is contained in:
Jerry Kingsbury
2025-05-05 16:29:34 -05:00
committed by LGUG2Z
parent 8c10547325
commit 80bce4be7e

View File

@@ -2291,6 +2291,25 @@ mod tests {
assert_eq!(container.windows().len(), 1);
}
#[test]
fn test_move_window_to_non_existent_container() {
let mut workspace = Workspace::default();
// Add a container with one window
let mut container = Container::default();
container.windows_mut().push_back(Window::from(1));
workspace.add_container_to_back(container);
// Try to move window to a non-existent container
let result = workspace.move_window_to_container(8);
// Should return an error
assert!(
result.is_err(),
"Expected an error when moving a window to a non-existent container"
);
}
#[test]
fn test_remove_window() {
let mut workspace = Workspace::default();