forked from AbleScript/ablescript
Fix broken type_errors
unit test
This commit is contained in:
parent
594968f781
commit
003d800d6e
|
@ -508,11 +508,11 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn type_errors() {
|
fn type_coercions() {
|
||||||
// The sum of an integer and a boolean results in a type
|
// The sum of an integer and a boolean causes a boolean
|
||||||
// error.
|
// coercion.
|
||||||
let env = ExecEnv::new();
|
let env = ExecEnv::new();
|
||||||
assert!(matches!(
|
assert_eq!(
|
||||||
env.eval_expr(&Expr {
|
env.eval_expr(&Expr {
|
||||||
kind: ExprKind::BinOp {
|
kind: ExprKind::BinOp {
|
||||||
lhs: Box::new(Expr {
|
lhs: Box::new(Expr {
|
||||||
|
@ -526,12 +526,10 @@ mod tests {
|
||||||
kind: crate::ast::BinOpKind::Add,
|
kind: crate::ast::BinOpKind::Add,
|
||||||
},
|
},
|
||||||
span: 1..1
|
span: 1..1
|
||||||
}),
|
|
||||||
Err(Error {
|
|
||||||
kind: ErrorKind::TypeError(_),
|
|
||||||
span: _,
|
|
||||||
})
|
})
|
||||||
));
|
.unwrap(),
|
||||||
|
Value::Int(3)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in a new issue