diff --git a/src/error.rs b/src/error.rs index 2f11ccf..6b24ea0 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,5 +1,6 @@ use std::process::Command; +#[derive(Debug)] pub enum ShellError { EmptyLine, Exit, @@ -7,3 +8,15 @@ pub enum ShellError { ExecuteFailure(String), MalformedArgs(String), } + +impl PartialEq for ShellError { + fn eq(&self, other: &Self) -> bool { + match self { + &ShellError::EmptyLine => matches!(other, ShellError::EmptyLine), + &ShellError::Exit => matches!(other, ShellError::Exit), + &ShellError::NotFound(_) => matches!(other, ShellError::NotFound(_)), + &ShellError::ExecuteFailure(_) => matches!(other, ShellError::ExecuteFailure(_)), + &ShellError::MalformedArgs(_) => matches!(other, ShellError::MalformedArgs(_)), + } + } +}