1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#[test]
fn detach_client() {
use crate::{DetachClient, TargetSession};
use std::borrow::Cow;
let target_session = TargetSession::Raw("2").to_string();
let mut detach_client = DetachClient::new();
#[cfg(feature = "tmux_2_2")]
detach_client.all();
#[cfg(feature = "tmux_1_5")]
detach_client.parent_sighup();
#[cfg(feature = "tmux_2_4")]
detach_client.shell_command("1");
#[cfg(feature = "tmux_1_5")]
detach_client.target_session(&target_session);
#[cfg(feature = "tmux_0_8")]
detach_client.target_client("3");
#[cfg(not(feature = "cmd_alias"))]
let cmd = "detach-client";
#[cfg(feature = "cmd_alias")]
let cmd = "detach";
let mut s = Vec::new();
#[cfg(feature = "tmux_2_2")]
s.push("-a");
#[cfg(feature = "tmux_1_5")]
s.push("-P");
#[cfg(feature = "tmux_2_4")]
s.extend_from_slice(&["-E", "1"]);
#[cfg(feature = "tmux_1_5")]
s.extend_from_slice(&["-s", "2"]);
#[cfg(feature = "tmux_0_8")]
s.extend_from_slice(&["-t", "3"]);
let s = s.into_iter().map(|a| a.into()).collect();
assert_eq!(detach_client.0.bin, Cow::Borrowed("tmux"));
assert_eq!(detach_client.0.bin_args, None);
assert_eq!(detach_client.0.cmd, Some(Cow::Borrowed(cmd)));
assert_eq!(detach_client.0.cmd_args, Some(s));
}