diff --git a/src/interpret.rs b/src/interpret.rs index 27dd2b1..da0560a 100644 --- a/src/interpret.rs +++ b/src/interpret.rs @@ -442,7 +442,7 @@ mod tests { // Integer overflow should throw a recoverable error instead // of panicking. let env = ExecEnv::new(); - assert!(matches!( + assert_eq!( env.eval_expr(&Expr { kind: ExprKind::BinOp { lhs: Box::new(Expr { @@ -456,15 +456,13 @@ mod tests { kind: crate::ast::BinOpKind::Add, }, span: 1..1 - }), - Err(Error { - kind: ErrorKind::ArithmeticError, - span: _, }) - )); + .unwrap(), + Value::Int(42) + ); // And the same for divide by zero. - assert!(matches!( + assert_eq!( env.eval_expr(&Expr { kind: ExprKind::BinOp { lhs: Box::new(Expr { @@ -478,12 +476,10 @@ mod tests { kind: crate::ast::BinOpKind::Divide, }, span: 1..1 - }), - Err(Error { - kind: ErrorKind::ArithmeticError, - span: _, }) - )); + .unwrap(), + Value::Int(42) + ); } // From here on out, I'll use this function to parse and run