mirror of
https://gitlab.com/hyask/swaysome.git
synced 2025-12-10 07:44:43 +01:00
Compare commits
2 commits
48d4c8388d
...
eb2dc1de1d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb2dc1de1d | ||
|
|
f9a0c22e9b |
2 changed files with 33 additions and 5 deletions
|
|
@ -59,11 +59,9 @@ impl SwaySome {
|
||||||
};
|
};
|
||||||
|
|
||||||
let socket = Path::new(&socket_path);
|
let socket = Path::new(&socket_path);
|
||||||
if socket.is_file() {
|
match SwaySome::new_from_socket(socket) {
|
||||||
match SwaySome::new_from_socket(socket) {
|
Ok(swaysome) => return swaysome,
|
||||||
Ok(swaysome) => return swaysome,
|
Err(e) => eprintln!("Error with value found in ${}: {}", socket_var, e),
|
||||||
Err(e) => eprintln!("Error with value found in ${}: {}", socket_var, e),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
panic!("couldn't find any i3/sway socket")
|
panic!("couldn't find any i3/sway socket")
|
||||||
|
|
|
||||||
30
tests/integration_bin.rs
Normal file
30
tests/integration_bin.rs
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
use std::process::Command;
|
||||||
|
|
||||||
|
mod utils;
|
||||||
|
use utils::Sway;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_binary_help() {
|
||||||
|
let output = Command::new("./target/debug/swaysome")
|
||||||
|
.args(["-h"])
|
||||||
|
.env_clear()
|
||||||
|
.env("SWAYSOCK", "/dev/null")
|
||||||
|
.output()
|
||||||
|
.expect("Couldn't run swaymsg");
|
||||||
|
assert_eq!(String::from_utf8(output.stdout).unwrap(), "Better multimonitor handling for sway\n\nUsage: swaysome <COMMAND>\n\nCommands:\n init Initialize the workspace groups for all the outputs\n move Move the focused container to another workspace on the same workspace group\n move-to-group Move the focused container to the same workspace index on another workspace group\n focus Focus to another workspace on the same workspace group\n focus-group Focus to workspace group\n focus-all-outputs Focus to another workspace on all the outputs\n next-output Move the focused container to the next output\n prev-output Move the focused container to the previous output\n workspace-group-next-output Move the focused workspace group to the next output\n workspace-group-prev-output Move the focused workspace group to the previous output\n next-group Move the focused container to the next group\n prev-group Move the focused container to the previous group\n rearrange-workspaces Rearrange already opened workspaces to the correct outputs, useful when plugging new monitors\n help Print this message or the help of the given subcommand(s)\n\nOptions:\n -h, --help Print help\n -V, --version Print version\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// We only test the 'init' command, given that the exhaustive command testing
|
||||||
|
/// is done in the library integration tests. Here, we only verify that the
|
||||||
|
/// interaction with `sway` works seamslessly.
|
||||||
|
#[test]
|
||||||
|
fn test_binary_interaction_with_sway() {
|
||||||
|
let sway = Sway::start();
|
||||||
|
let output = Command::new("./target/debug/swaysome")
|
||||||
|
.args(["init", "1"])
|
||||||
|
.env_clear()
|
||||||
|
.env("SWAYSOCK", sway.sock.clone())
|
||||||
|
.output()
|
||||||
|
.expect("Couldn't run swaymsg");
|
||||||
|
assert_eq!(String::from_utf8(output.stderr).unwrap(), "successful connection to socket '/tmp/swaysome_tests/test_binary_interaction_with_sway/swaysock'\nSending command: 'focus output HEADLESS-3' - Command successful\nSending command: 'workspace number 31' - Command successful\nSending command: 'focus output HEADLESS-2' - Command successful\nSending command: 'workspace number 21' - Command successful\nSending command: 'focus output HEADLESS-1' - Command successful\nSending command: 'workspace number 11' - Command successful\n");
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue