diff --git a/src/command.rs b/src/command.rs index 8b9e2dc..3e3f5f1 100644 --- a/src/command.rs +++ b/src/command.rs @@ -84,4 +84,29 @@ impl Display for ExecutionError { } } -impl Error for ExecutionError {} \ No newline at end of file +impl Error for ExecutionError {} + +#[cfg(test)] +mod test { + use crate::command::{ExecutionError, LogRunnable, SpecificExecutionError}; + use crate::logger::Logger; + use std::process::Command; + + #[test] + fn test_unknown_command() { + let mut command = Command::new("a_command_which_def_doesnt_exist"); + let Err( + e @ SpecificExecutionError { + error: ExecutionError::StartError(_), + .. + }, + ) = command.args(["foo", "bar"]).run(&Logger::default()) + else { + panic!("command shouldn't exist"); + }; + println!("{e}"); + } + + #[test] + fn test_error() {} +}