1mod common;
2
3#[test]
4fn basic() {
5    let name = "my-app";
6    let cmd = common::basic_command(name);
7    common::assert_matches_path(
8        "tests/snapshots/basic.bash",
9        clap_complete::shells::Bash,
10        cmd,
11        name,
12    );
13}
14
15#[test]
16fn feature_sample() {
17    let name = "my-app";
18    let cmd = common::feature_sample_command(name);
19    common::assert_matches_path(
20        "tests/snapshots/feature_sample.bash",
21        clap_complete::shells::Bash,
22        cmd,
23        name,
24    );
25}
26
27#[test]
28fn special_commands() {
29    let name = "my-app";
30    let cmd = common::special_commands_command(name);
31    common::assert_matches_path(
32        "tests/snapshots/special_commands.bash",
33        clap_complete::shells::Bash,
34        cmd,
35        name,
36    );
37}
38
39#[test]
40fn quoting() {
41    let name = "my-app";
42    let cmd = common::quoting_command(name);
43    common::assert_matches_path(
44        "tests/snapshots/quoting.bash",
45        clap_complete::shells::Bash,
46        cmd,
47        name,
48    );
49}
50
51#[test]
52fn aliases() {
53    let name = "my-app";
54    let cmd = common::aliases_command(name);
55    common::assert_matches_path(
56        "tests/snapshots/aliases.bash",
57        clap_complete::shells::Bash,
58        cmd,
59        name,
60    );
61}
62
63#[test]
64fn sub_subcommands() {
65    let name = "my-app";
66    let cmd = common::sub_subcommands_command(name);
67    common::assert_matches_path(
68        "tests/snapshots/sub_subcommands.bash",
69        clap_complete::shells::Bash,
70        cmd,
71        name,
72    );
73}
74
75#[test]
76fn value_hint() {
77    let name = "my-app";
78    let cmd = common::value_hint_command(name);
79    common::assert_matches_path(
80        "tests/snapshots/value_hint.bash",
81        clap_complete::shells::Bash,
82        cmd,
83        name,
84    );
85}
86
87#[test]
88fn value_terminator() {
89    let name = "my-app";
90    let cmd = common::value_terminator_command(name);
91    common::assert_matches_path(
92        "tests/snapshots/value_terminator.bash",
93        clap_complete::shells::Bash,
94        cmd,
95        name,
96    );
97}
98
99#[cfg(feature = "unstable-dynamic")]
100#[test]
101fn register_minimal() {
102    let name = "my-app";
103    let executables = [name];
104    let completer = name;
105    let behavior = clap_complete::dynamic::bash::Behavior::Minimal;
106
107    let mut buf = Vec::new();
108    clap_complete::dynamic::bash::register(name, executables, completer, &behavior, &mut buf)
109        .unwrap();
110    snapbox::Assert::new()
111        .action_env("SNAPSHOTS")
112        .matches_path("tests/snapshots/register_minimal.bash", buf);
113}
114
115#[test]
116fn two_multi_valued_arguments() {
117    let name = "my-app";
118    let cmd = common::two_multi_valued_arguments_command(name);
119    common::assert_matches_path(
120        "tests/snapshots/two_multi_valued_arguments.bash",
121        clap_complete::shells::Bash,
122        cmd,
123        name,
124    );
125}
126