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 find_window() {
use crate::{FindWindow, TargetPane};
use std::borrow::Cow;
let target_pane = TargetPane::Raw("1").to_string();
let mut find_window = FindWindow::new();
#[cfg(feature = "tmux_3_0")]
find_window.regex();
#[cfg(feature = "tmux_1_7")]
find_window.only_visible();
#[cfg(feature = "tmux_1_7")]
find_window.only_name();
#[cfg(feature = "tmux_1_7")]
find_window.only_title();
#[cfg(feature = "tmux_3_0")]
find_window.zoom();
#[cfg(feature = "tmux_0_8")]
find_window.target_pane(&target_pane);
#[cfg(not(feature = "cmd_alias"))]
let cmd = "find-window";
#[cfg(feature = "cmd_alias")]
let cmd = "findw";
let mut s = Vec::new();
#[cfg(feature = "tmux_3_0")]
s.push("-r");
#[cfg(feature = "tmux_1_7")]
s.push("-C");
#[cfg(feature = "tmux_1_7")]
s.push("-N");
#[cfg(feature = "tmux_1_7")]
s.push("-T");
#[cfg(feature = "tmux_3_0")]
s.push("-Z");
#[cfg(feature = "tmux_0_8")]
s.extend_from_slice(&["-t", "1"]);
let s = s.into_iter().map(|a| a.into()).collect();
assert_eq!(find_window.0.bin, Cow::Borrowed("tmux"));
assert_eq!(find_window.0.bin_args, None);
assert_eq!(find_window.0.cmd, Some(Cow::Borrowed(cmd)));
assert_eq!(find_window.0.cmd_args, Some(s));
}