Use ? operator in tests.

This commit is contained in:
Stephen Chung
2020-03-09 21:09:53 +08:00
parent 63482d5a79
commit 5b5fd162be
6 changed files with 51 additions and 28 deletions

View File

@@ -40,9 +40,9 @@ fn test_scope_eval() -> Result<(), EvalAltResult> {
.expect("y and z not found?");
// Second invocation using the same state
if let Ok(result) = engine.eval_with_scope::<i64>(&mut scope, "x") {
println!("result: {}", result); // should print 966
}
let result = engine.eval_with_scope::<i64>(&mut scope, "x")?;
println!("result: {}", result); // should print 966
// Variable y is changed in the script
assert_eq!(scope.get_value::<i64>("y").unwrap(), 1);