Fine tune some tests.
This commit is contained in:
parent
0d1a240292
commit
4662b9bd0c
@ -62,12 +62,10 @@ fn test_bool_op_short_circuit() -> Result<(), EvalAltResult> {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_bool_op_no_short_circuit1() {
|
||||
let mut engine = Engine::new();
|
||||
|
||||
assert_eq!(
|
||||
engine
|
||||
assert!(engine
|
||||
.eval::<bool>(
|
||||
r"
|
||||
let this = true;
|
||||
@ -75,18 +73,14 @@ fn test_bool_op_no_short_circuit1() {
|
||||
this | { throw; }
|
||||
"
|
||||
)
|
||||
.unwrap(),
|
||||
false
|
||||
);
|
||||
.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_bool_op_no_short_circuit2() {
|
||||
let mut engine = Engine::new();
|
||||
|
||||
assert_eq!(
|
||||
engine
|
||||
assert!(engine
|
||||
.eval::<bool>(
|
||||
r"
|
||||
let this = false;
|
||||
@ -94,7 +88,5 @@ fn test_bool_op_no_short_circuit2() {
|
||||
this & { throw; }
|
||||
"
|
||||
)
|
||||
.unwrap(),
|
||||
false
|
||||
);
|
||||
.is_err());
|
||||
}
|
||||
|
@ -42,7 +42,15 @@ fn test_scope_eval() -> Result<(), EvalAltResult> {
|
||||
println!("result: {}", result); // should print 966
|
||||
|
||||
// Variable y is changed in the script
|
||||
assert_eq!(scope.get_value::<INT>("y").unwrap(), 1);
|
||||
assert_eq!(
|
||||
scope
|
||||
.get_value::<INT>("y")
|
||||
.ok_or(EvalAltResult::ErrorRuntime(
|
||||
"variable y not found".into(),
|
||||
Default::default()
|
||||
))?,
|
||||
1
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user