1) Change namespaces to iter_namespaces
2) throw can throw any value
This commit is contained in:
@@ -5,12 +5,12 @@ fn test_throw() {
|
||||
let engine = Engine::new();
|
||||
|
||||
assert!(matches!(
|
||||
*engine.eval::<()>(r#"if true { throw "hello" }"#).expect_err("expects error"),
|
||||
EvalAltResult::ErrorRuntime(s, _) if s == "hello"
|
||||
*engine.eval::<()>("if true { throw 42 }").expect_err("expects error"),
|
||||
EvalAltResult::ErrorRuntime(s, _) if s.as_int().unwrap() == 42
|
||||
));
|
||||
|
||||
assert!(matches!(
|
||||
*engine.eval::<()>(r#"throw"#).expect_err("expects error"),
|
||||
EvalAltResult::ErrorRuntime(s, _) if s == ""
|
||||
EvalAltResult::ErrorRuntime(s, _) if s.is::<()>()
|
||||
));
|
||||
}
|
||||
|
Reference in New Issue
Block a user