|
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; |
| 11 | +#[cfg(feature = "testing_commandline")] |
| 12 | +use std::{env, fs::File, io::Read}; |
14 | 13 | use std::path::Path; |
| 14 | + |
| 15 | +#[cfg(feature = "testing_commandline")] |
15 | 16 | use tempfile::Builder; |
16 | 17 |
|
| 18 | +#[cfg(feature = "testing_commandline")] |
| 19 | +use common::test_helpers::{fix_up_slashes, path_to_testing_commandline}; |
17 | 20 | use common::test_helpers::{ |
18 | | - fix_up_slashes, get_dir_entry_for, path_to_testing_commandline, FakeDependencies, |
| 21 | + get_dir_entry_for, FakeDependencies, |
19 | 22 | }; |
20 | | -use findutils::find::matchers::exec::{MultiExecMatcher, SingleExecMatcher}; |
21 | | -use findutils::find::matchers::{Matcher, MatcherIO}; |
| 23 | +#[cfg(feature = "testing_commandline")] |
| 24 | +use findutils::find::matchers::exec::SingleExecMatcher; |
| 25 | +use findutils::find::matchers::exec::MultiExecMatcher; |
| 26 | +#[cfg(feature = "testing_commandline")] |
| 27 | +use findutils::find::matchers::MatcherIO; |
| 28 | +use findutils::find::matchers::Matcher; |
22 | 29 |
|
23 | 30 | mod common; |
24 | 31 |
|
| 32 | +#[cfg(feature = "testing_commandline")] |
25 | 33 | #[test] |
26 | 34 | fn matching_executes_code() { |
27 | 35 | let temp_dir = Builder::new() |
@@ -53,6 +61,7 @@ fn matching_executes_code() { |
53 | 61 | ); |
54 | 62 | } |
55 | 63 |
|
| 64 | +#[cfg(feature = "testing_commandline")] |
56 | 65 | #[test] |
57 | 66 | fn matching_executes_code_in_files_directory() { |
58 | 67 | let temp_dir = Builder::new() |
@@ -84,6 +93,7 @@ fn matching_executes_code_in_files_directory() { |
84 | 93 | ); |
85 | 94 | } |
86 | 95 |
|
| 96 | +#[cfg(feature = "testing_commandline")] |
87 | 97 | #[test] |
88 | 98 | fn matching_embedded_filename() { |
89 | 99 | let temp_dir = Builder::new() |
@@ -115,6 +125,7 @@ fn matching_embedded_filename() { |
115 | 125 | ); |
116 | 126 | } |
117 | 127 |
|
| 128 | +#[cfg(feature = "testing_commandline")] |
118 | 129 | #[test] |
119 | 130 | /// Running "find . -execdir whatever \;" failed with a No such file or directory error. |
120 | 131 | /// It's now fixed, and this is a regression test to check that it stays fixed. |
@@ -148,6 +159,7 @@ fn execdir_in_current_directory() { |
148 | 159 | ); |
149 | 160 | } |
150 | 161 |
|
| 162 | +#[cfg(feature = "testing_commandline")] |
151 | 163 | #[test] |
152 | 164 | /// Regression test for "find / -execdir whatever \;" |
153 | 165 | fn execdir_in_root_directory() { |
@@ -187,6 +199,7 @@ fn execdir_in_root_directory() { |
187 | 199 | ); |
188 | 200 | } |
189 | 201 |
|
| 202 | +#[cfg(feature = "testing_commandline")] |
190 | 203 | #[test] |
191 | 204 | fn matching_fails_if_executable_fails() { |
192 | 205 | let temp_dir = Builder::new() |
@@ -225,6 +238,7 @@ fn matching_fails_if_executable_fails() { |
225 | 238 | ); |
226 | 239 | } |
227 | 240 |
|
| 241 | +#[cfg(feature = "testing_commandline")] |
228 | 242 | #[test] |
229 | 243 | fn matching_multi_executes_code() { |
230 | 244 | let temp_dir = Builder::new() |
@@ -258,6 +272,7 @@ fn matching_multi_executes_code() { |
258 | 272 | ); |
259 | 273 | } |
260 | 274 |
|
| 275 | +#[cfg(feature = "testing_commandline")] |
261 | 276 | #[test] |
262 | 277 | fn execdir_multi_in_current_directory() { |
263 | 278 | let temp_dir = Builder::new() |
@@ -292,6 +307,7 @@ fn execdir_multi_in_current_directory() { |
292 | 307 | ); |
293 | 308 | } |
294 | 309 |
|
| 310 | +#[cfg(feature = "testing_commandline")] |
295 | 311 | #[test] |
296 | 312 | fn multi_set_exit_code_if_executable_fails() { |
297 | 313 | let temp_dir = Builder::new() |
|
0 commit comments