|
8 | 8 | /// ! But as the tests require running an external executable, they need to be run |
9 | 9 | /// ! as integration tests so we can ensure that our testing-commandline binary |
10 | 10 | /// ! has been built. |
11 | | -use std::env; |
12 | | -use std::fs::File; |
13 | | -use std::io::Read; |
14 | 11 | use std::path::Path; |
| 12 | +#[cfg(feature = "testing_commandline")] |
| 13 | +use std::{env, fs::File, io::Read}; |
| 14 | + |
| 15 | +#[cfg(feature = "testing_commandline")] |
15 | 16 | use tempfile::Builder; |
16 | 17 |
|
17 | | -use common::test_helpers::{ |
18 | | - fix_up_slashes, get_dir_entry_for, path_to_testing_commandline, FakeDependencies, |
19 | | -}; |
20 | | -use findutils::find::matchers::exec::{MultiExecMatcher, SingleExecMatcher}; |
21 | | -use findutils::find::matchers::{Matcher, MatcherIO}; |
| 18 | +#[cfg(feature = "testing_commandline")] |
| 19 | +use common::test_helpers::{fix_up_slashes, path_to_testing_commandline}; |
| 20 | +use common::test_helpers::{get_dir_entry_for, FakeDependencies}; |
| 21 | +use findutils::find::matchers::exec::MultiExecMatcher; |
| 22 | +#[cfg(feature = "testing_commandline")] |
| 23 | +use findutils::find::matchers::exec::SingleExecMatcher; |
| 24 | +use findutils::find::matchers::Matcher; |
| 25 | +#[cfg(feature = "testing_commandline")] |
| 26 | +use findutils::find::matchers::MatcherIO; |
22 | 27 |
|
23 | 28 | mod common; |
24 | 29 |
|
| 30 | +#[cfg(feature = "testing_commandline")] |
25 | 31 | #[test] |
26 | 32 | fn matching_executes_code() { |
27 | 33 | let temp_dir = Builder::new() |
@@ -53,6 +59,7 @@ fn matching_executes_code() { |
53 | 59 | ); |
54 | 60 | } |
55 | 61 |
|
| 62 | +#[cfg(feature = "testing_commandline")] |
56 | 63 | #[test] |
57 | 64 | fn matching_executes_code_in_files_directory() { |
58 | 65 | let temp_dir = Builder::new() |
@@ -84,6 +91,7 @@ fn matching_executes_code_in_files_directory() { |
84 | 91 | ); |
85 | 92 | } |
86 | 93 |
|
| 94 | +#[cfg(feature = "testing_commandline")] |
87 | 95 | #[test] |
88 | 96 | fn matching_embedded_filename() { |
89 | 97 | let temp_dir = Builder::new() |
@@ -115,6 +123,7 @@ fn matching_embedded_filename() { |
115 | 123 | ); |
116 | 124 | } |
117 | 125 |
|
| 126 | +#[cfg(feature = "testing_commandline")] |
118 | 127 | #[test] |
119 | 128 | /// Running "find . -execdir whatever \;" failed with a No such file or directory error. |
120 | 129 | /// It's now fixed, and this is a regression test to check that it stays fixed. |
@@ -148,6 +157,7 @@ fn execdir_in_current_directory() { |
148 | 157 | ); |
149 | 158 | } |
150 | 159 |
|
| 160 | +#[cfg(feature = "testing_commandline")] |
151 | 161 | #[test] |
152 | 162 | /// Regression test for "find / -execdir whatever \;" |
153 | 163 | fn execdir_in_root_directory() { |
@@ -187,6 +197,7 @@ fn execdir_in_root_directory() { |
187 | 197 | ); |
188 | 198 | } |
189 | 199 |
|
| 200 | +#[cfg(feature = "testing_commandline")] |
190 | 201 | #[test] |
191 | 202 | fn matching_fails_if_executable_fails() { |
192 | 203 | let temp_dir = Builder::new() |
@@ -225,6 +236,7 @@ fn matching_fails_if_executable_fails() { |
225 | 236 | ); |
226 | 237 | } |
227 | 238 |
|
| 239 | +#[cfg(feature = "testing_commandline")] |
228 | 240 | #[test] |
229 | 241 | fn matching_multi_executes_code() { |
230 | 242 | let temp_dir = Builder::new() |
@@ -258,6 +270,7 @@ fn matching_multi_executes_code() { |
258 | 270 | ); |
259 | 271 | } |
260 | 272 |
|
| 273 | +#[cfg(feature = "testing_commandline")] |
261 | 274 | #[test] |
262 | 275 | fn execdir_multi_in_current_directory() { |
263 | 276 | let temp_dir = Builder::new() |
@@ -292,6 +305,7 @@ fn execdir_multi_in_current_directory() { |
292 | 305 | ); |
293 | 306 | } |
294 | 307 |
|
| 308 | +#[cfg(feature = "testing_commandline")] |
295 | 309 | #[test] |
296 | 310 | fn multi_set_exit_code_if_executable_fails() { |
297 | 311 | let temp_dir = Builder::new() |
|
0 commit comments