feat(tests): implement a way to express that tests can fail

This commit is contained in:
rvcas
2023-05-25 16:54:53 -04:00
parent 65bf4a85e4
commit a124a16a61
12 changed files with 131 additions and 11 deletions

View File

@@ -32,10 +32,14 @@ impl EvalResult {
std::mem::take(&mut self.logs)
}
pub fn failed(&self) -> bool {
matches!(self.result, Err(_))
|| matches!(self.result, Ok(Term::Error))
|| matches!(self.result, Ok(Term::Constant(ref con)) if matches!(con.as_ref(), Constant::Bool(false)))
pub fn failed(&self, can_error: bool) -> bool {
if can_error {
!matches!(self.result, Err(_))
} else {
matches!(self.result, Err(_))
|| matches!(self.result, Ok(Term::Error))
|| matches!(self.result, Ok(Term::Constant(ref con)) if matches!(con.as_ref(), Constant::Bool(false)))
}
}
pub fn result(self) -> Result<Term<NamedDeBruijn>, Error> {