Add unit test to command module
This commit is contained in:
parent
9befc1fcf2
commit
b6002b635d
@ -85,3 +85,28 @@ impl Display for ExecutionError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Error for ExecutionError {}
|
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() {}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user