Debian Codegraph @

tests/integration/arg_tests.rs

raw symbols SCIP
1 //! These tests are mostly here just to ensure that invalid results will be
2 //! caught when passing arguments.
3
4 use assert_cmdrust-analyzer cargo assert_cmd 2.2.2 crate/::preluderust-analyzer cargo assert_cmd 2.2.2 prelude/::*;
5 use predicatesrust-analyzer cargo predicates 3.1.4 crate/::preluderust-analyzer cargo predicates 3.1.4 prelude/::*;
6
7 use craterust-analyzer cargo bottom 0.14.9 crate/::utilrust-analyzer cargo bottom 0.14.9 util/::{btm_commandrust-analyzer cargo bottom 0.14.9 util/btm_command()., no_cfg_btm_commandrust-analyzer cargo bottom 0.14.9 util/no_cfg_btm_command().};
8
9 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
10 fn test_small_raterust-analyzer cargo bottom 0.14.9 arg_tests/test_small_rate().() {
11 btm_commandrust-analyzer cargo bottom 0.14.9 util/btm_command().(&["-C", "./tests/valid_configs/empty_config.toml"])
12 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("-r")
13 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("249")
14 .assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().()
15 .failurerust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]failure().()
16 .stderrrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]stderr().(predicaterust-analyzer cargo predicates 3.1.4 prelude/predicate/::strrust-analyzer cargo predicates 3.1.4 prelude/predicate/str/::containsrust-analyzer cargo predicates 3.1.4 str/basics/contains().("'--rate' must be greater"));
17 }
18
19 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
20 fn test_large_default_timerust-analyzer cargo bottom 0.14.9 arg_tests/test_large_default_time().() {
21 no_cfg_btm_commandrust-analyzer cargo bottom 0.14.9 util/no_cfg_btm_command().()
22 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("-t")
23 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("18446744073709551616")
24 .assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().()
25 .failurerust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]failure().()
26 .stderrrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]stderr().(predicaterust-analyzer cargo predicates 3.1.4 prelude/predicate/::strrust-analyzer cargo predicates 3.1.4 prelude/predicate/str/::containsrust-analyzer cargo predicates 3.1.4 str/basics/contains().(
27 "'--default_time_value' was set with an invalid value",
28 ));
29 }
30
31 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
32 fn test_small_default_timerust-analyzer cargo bottom 0.14.9 arg_tests/test_small_default_time().() {
33 no_cfg_btm_commandrust-analyzer cargo bottom 0.14.9 util/no_cfg_btm_command().()
34 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("-t")
35 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("900")
36 .assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().()
37 .failurerust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]failure().()
38 .stderrrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]stderr().(predicaterust-analyzer cargo predicates 3.1.4 prelude/predicate/::strrust-analyzer cargo predicates 3.1.4 prelude/predicate/str/::containsrust-analyzer cargo predicates 3.1.4 str/basics/contains().(
39 "'--default_time_value' must be greater",
40 ));
41 }
42
43 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
44 fn test_large_delta_timerust-analyzer cargo bottom 0.14.9 arg_tests/test_large_delta_time().() {
45 no_cfg_btm_commandrust-analyzer cargo bottom 0.14.9 util/no_cfg_btm_command().()
46 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("-d")
47 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("18446744073709551616")
48 .assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().()
49 .failurerust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]failure().()
50 .stderrrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]stderr().(predicaterust-analyzer cargo predicates 3.1.4 prelude/predicate/::strrust-analyzer cargo predicates 3.1.4 prelude/predicate/str/::containsrust-analyzer cargo predicates 3.1.4 str/basics/contains().(
51 "'--time_delta' was set with an invalid value",
52 ));
53 }
54
55 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
56 fn test_small_delta_timerust-analyzer cargo bottom 0.14.9 arg_tests/test_small_delta_time().() {
57 no_cfg_btm_commandrust-analyzer cargo bottom 0.14.9 util/no_cfg_btm_command().()
58 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("-d")
59 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("900")
60 .assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().()
61 .failurerust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]failure().()
62 .stderrrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]stderr().(predicaterust-analyzer cargo predicates 3.1.4 prelude/predicate/::strrust-analyzer cargo predicates 3.1.4 prelude/predicate/str/::containsrust-analyzer cargo predicates 3.1.4 str/basics/contains().("'--time_delta' must be greater"));
63 }
64
65 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
66 fn test_large_raterust-analyzer cargo bottom 0.14.9 arg_tests/test_large_rate().() {
67 no_cfg_btm_commandrust-analyzer cargo bottom 0.14.9 util/no_cfg_btm_command().()
68 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("-r")
69 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("18446744073709551616")
70 .assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().()
71 .failurerust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]failure().()
72 .stderrrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]stderr().(predicaterust-analyzer cargo predicates 3.1.4 prelude/predicate/::strrust-analyzer cargo predicates 3.1.4 prelude/predicate/str/::containsrust-analyzer cargo predicates 3.1.4 str/basics/contains().(
73 "'--rate' was set with an invalid value",
74 ));
75 }
76
77 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
78 fn test_negative_raterust-analyzer cargo bottom 0.14.9 arg_tests/test_negative_rate().() {
79 // This test should auto fail due to how clap works
80 no_cfg_btm_commandrust-analyzer cargo bottom 0.14.9 util/no_cfg_btm_command().()
81 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("-r")
82 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("-1000")
83 .assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().()
84 .failurerust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]failure().()
85 .stderrrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]stderr().(predicaterust-analyzer cargo predicates 3.1.4 prelude/predicate/::strrust-analyzer cargo predicates 3.1.4 prelude/predicate/str/::containsrust-analyzer cargo predicates 3.1.4 str/basics/contains().("unexpected argument"));
86 }
87
88 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
89 fn test_invalid_raterust-analyzer cargo bottom 0.14.9 arg_tests/test_invalid_rate().() {
90 no_cfg_btm_commandrust-analyzer cargo bottom 0.14.9 util/no_cfg_btm_command().()
91 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("-r")
92 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("100-1000")
93 .assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().()
94 .failurerust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]failure().()
95 .stderrrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]stderr().(predicaterust-analyzer cargo predicates 3.1.4 prelude/predicate/::strrust-analyzer cargo predicates 3.1.4 prelude/predicate/str/::containsrust-analyzer cargo predicates 3.1.4 str/basics/contains().(
96 "'--rate' was set with an invalid value",
97 ));
98 }
99
100 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
101 fn test_conflicting_tempsrust-analyzer cargo bottom 0.14.9 arg_tests/test_conflicting_temps().() {
102 no_cfg_btm_commandrust-analyzer cargo bottom 0.14.9 util/no_cfg_btm_command().()
103 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("-c")
104 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("-f")
105 .assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().()
106 .failurerust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]failure().()
107 .stderrrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]stderr().(predicaterust-analyzer cargo predicates 3.1.4 prelude/predicate/::strrust-analyzer cargo predicates 3.1.4 prelude/predicate/str/::containsrust-analyzer cargo predicates 3.1.4 str/basics/contains().("cannot be used with"));
108 }
109
110 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
111 fn test_invalid_default_widget_1rust-analyzer cargo bottom 0.14.9 arg_tests/test_invalid_default_widget_1().() {
112 no_cfg_btm_commandrust-analyzer cargo bottom 0.14.9 util/no_cfg_btm_command().()
113 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("--default_widget_type")
114 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("fake_widget")
115 .assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().()
116 .failurerust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]failure().()
117 .stderrrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]stderr().(predicaterust-analyzer cargo predicates 3.1.4 prelude/predicate/::strrust-analyzer cargo predicates 3.1.4 prelude/predicate/str/::containsrust-analyzer cargo predicates 3.1.4 str/basics/contains().("invalid value"));
118 }
119
120 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
121 fn test_invalid_default_widget_2rust-analyzer cargo bottom 0.14.9 arg_tests/test_invalid_default_widget_2().() {
122 no_cfg_btm_commandrust-analyzer cargo bottom 0.14.9 util/no_cfg_btm_command().()
123 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("--default_widget_type")
124 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("cpu")
125 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("--default_widget_count")
126 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("18446744073709551616")
127 .assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().()
128 .failurerust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]failure().()
129 .stderrrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]stderr().(predicaterust-analyzer cargo predicates 3.1.4 prelude/predicate/::strrust-analyzer cargo predicates 3.1.4 prelude/predicate/str/::containsrust-analyzer cargo predicates 3.1.4 str/basics/contains().("number too large"));
130 }
131
132 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
133 fn test_missing_default_widget_typerust-analyzer cargo bottom 0.14.9 arg_tests/test_missing_default_widget_type().() {
134 no_cfg_btm_commandrust-analyzer cargo bottom 0.14.9 util/no_cfg_btm_command().()
135 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("--default_widget_count")
136 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("3")
137 .assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().()
138 .failurerust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]failure().()
139 .stderrrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]stderr().(predicaterust-analyzer cargo predicates 3.1.4 prelude/predicate/::strrust-analyzer cargo predicates 3.1.4 prelude/predicate/str/::containsrust-analyzer cargo predicates 3.1.4 str/basics/contains().(
140 "the following required arguments were not provided",
141 ));
142 }
143
144 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
145 fn test_invalid_default_cpu_entryrust-analyzer cargo bottom 0.14.9 arg_tests/test_invalid_default_cpu_entry().() {
146 no_cfg_btm_commandrust-analyzer cargo bottom 0.14.9 util/no_cfg_btm_command().()
147 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("--default_cpu_entry")
148 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("invalid")
149 .assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().()
150 .failurerust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]failure().()
151 .stderrrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]stderr().(predicaterust-analyzer cargo predicates 3.1.4 prelude/predicate/::strrust-analyzer cargo predicates 3.1.4 prelude/predicate/str/::containsrust-analyzer cargo predicates 3.1.4 str/basics/contains().("possible values"));
152 }
153
154 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
155 #[cfg_attr(feature = "battery", ignore)]
156 fn test_battery_flagrust-analyzer cargo bottom 0.14.9 arg_tests/test_battery_flag().() {
157 no_cfg_btm_commandrust-analyzer cargo bottom 0.14.9 util/no_cfg_btm_command().()
158 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("--battery")
159 .assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().()
160 .failurerust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]failure().()
161 .stderrrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]stderr().(predicaterust-analyzer cargo predicates 3.1.4 prelude/predicate/::strrust-analyzer cargo predicates 3.1.4 prelude/predicate/str/::containsrust-analyzer cargo predicates 3.1.4 str/basics/contains().(
162 "unexpected argument '--battery' found",
163 ));
164 }
165
166 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
167 #[cfg_attr(feature = "gpu", ignore)]
168 fn test_gpu_flagrust-analyzer cargo bottom 0.14.9 arg_tests/test_gpu_flag().() {
169 no_cfg_btm_commandrust-analyzer cargo bottom 0.14.9 util/no_cfg_btm_command().()
170 .argrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/impl#[Command]arg().("--disable_gpu")
171 .assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().()
172 .failurerust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]failure().()
173 .stderrrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]stderr().(predicaterust-analyzer cargo predicates 3.1.4 prelude/predicate/::strrust-analyzer cargo predicates 3.1.4 prelude/predicate/str/::containsrust-analyzer cargo predicates 3.1.4 str/basics/contains().(
174 "unexpected argument '--disable_gpu' found",
175 ));
176 }
177
178 /// Sanity test due to <https://github.com/ClementTsang/bottom/pull/1478>.
179 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
180 fn test_versionrust-analyzer cargo bottom 0.14.9 arg_tests/test_version().() {
181 btm_commandrust-analyzer cargo bottom 0.14.9 util/btm_command().(&["--version"]).assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().().successrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]success().();
182 btm_commandrust-analyzer cargo bottom 0.14.9 util/btm_command().(&["-V"]).assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().().successrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]success().();
183 }
184
185 /// Sanity test due to <https://github.com/ClementTsang/bottom/pull/1478>.
186 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
187 fn test_helprust-analyzer cargo bottom 0.14.9 arg_tests/test_help().() {
188 btm_commandrust-analyzer cargo bottom 0.14.9 util/btm_command().(&["--help"]).assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().().successrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]success().();
189 btm_commandrust-analyzer cargo bottom 0.14.9 util/btm_command().(&["-h"]).assertrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[`&mut process::Command`][OutputAssertExt]assert().().successrust-analyzer cargo assert_cmd 2.2.2 assert/impl#[Assert]success().();
190 }