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
70
71
72
73
74
75
76
77
78
79
80
81
82
#[test]
fn join_pane() {
use crate::{JoinPane, PaneSize, TargetPane};
use std::borrow::Cow;
let src_pane = TargetPane::Raw("2").to_string();
let dst_pane = TargetPane::Raw("3").to_string();
let mut join_pane = JoinPane::new();
#[cfg(feature = "tmux_2_6")]
join_pane.left_above();
#[cfg(feature = "tmux_1_2")]
join_pane.detached();
#[cfg(feature = "tmux_2_6")]
join_pane.full_size();
#[cfg(feature = "tmux_1_2")]
join_pane.horizontal();
#[cfg(feature = "tmux_1_2")]
join_pane.vertical();
#[cfg(feature = "tmux_1_2")]
join_pane.size(&PaneSize::Percentage(1));
#[cfg(feature = "tmux_1_2")]
join_pane.src_pane(&src_pane);
#[cfg(feature = "tmux_1_2")]
join_pane.dst_pane(&dst_pane);
#[cfg(not(feature = "cmd_alias"))]
let cmd = "join-pane";
#[cfg(feature = "cmd_alias")]
let cmd = "joinp";
let mut s = Vec::new();
#[cfg(feature = "tmux_2_6")]
s.push("-b");
#[cfg(feature = "tmux_1_2")]
s.push("-d");
#[cfg(feature = "tmux_2_6")]
s.push("-f");
#[cfg(feature = "tmux_1_2")]
s.push("-h");
#[cfg(feature = "tmux_1_2")]
s.push("-v");
#[cfg(all(feature = "tmux_1_2", not(feature = "tmux_3_1")))]
s.extend_from_slice(&["-l", "1%"]);
#[cfg(feature = "tmux_3_1")]
s.extend_from_slice(&["-p", "1"]);
#[cfg(feature = "tmux_1_2")]
s.extend_from_slice(&["-s", "2"]);
#[cfg(feature = "tmux_1_2")]
s.extend_from_slice(&["-t", "3"]);
let s = s.into_iter().map(|a| a.into()).collect();
assert_eq!(join_pane.0.bin, Cow::Borrowed("tmux"));
assert_eq!(join_pane.0.bin_args, None);
assert_eq!(join_pane.0.cmd, Some(Cow::Borrowed(cmd)));
assert_eq!(join_pane.0.cmd_args, Some(s));
}