Skip to content
Myr

Remove code duplication, add feature gate

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by sharkdp · committed by David Peter · parent 6c9e743 · Browse files · 1 file+4 added−19 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−19 removed

  • tests:+4 added−19 removed

1 file+4 added−19 removed

modified:tests/testenv/mod.rs+4 added-19 removed
207 unmodified lines
208 self.assert_output_subdirectory(".", args, expected)209 }210211 /// Similar to assert_output, but able to handle non-utf8 output212 #[cfg(all(unix, not(target_os = "macos")))]213 pub fn assert_output_raw(&self, args: &[&str], expected: &[u8]) {213 let actual = self.raw_output_subdirectory(".", args);214 assert_eq!(expected, actual.as_ref());214 let output = self.assert_success_and_get_output(".", args);215216 assert_eq!(expected, &output.stdout[..]);217 }218219 /// Assert that calling *fd* in the specified path under the root working directory,220 /// and with the specified arguments produces the expected output.
18 unmodified lines
239 panic!(format_output_error(args, &expected, &actual));240 }241 }242241 fn raw_output_subdirectory<P: AsRef<Path>>(&self, path: P, args: &[&str]) -> Box<[u8]> {242 // Setup *fd* command.243 let mut cmd = process::Command::new(&self.fd_exe);244 cmd.current_dir(self.temp_dir.path().join(path));245 cmd.args(args);246247 // Run *fd*.248 let output = cmd.output().expect("fd output");249250 // Check for exit status.251 if !output.status.success() {252 panic!(format_exit_error(args, &output));253 }254255 output.stdout.into_boxed_slice()256 }257243 /// Assert that calling *fd* with the specified arguments produces the expected error.244 pub fn assert_error(&self, args: &[&str], expected: &str) {245 self.assert_error_subdirectory(".", args, expected)246 }
24 unmodified lines