Fix unit tests
This commit is contained in:
parent
da9ff64486
commit
d1064802ec
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue