Change Engine::consume_XXX to Engine::run_XXX.

This commit is contained in:
Stephen Chung
2021-08-06 14:46:27 +08:00
parent e0125a1033
commit 180ad77224
23 changed files with 160 additions and 67 deletions

View File

@@ -6,7 +6,7 @@ use rhai::{
fn test_custom_syntax() -> Result<(), Box<EvalAltResult>> {
let mut engine = Engine::new();
engine.consume("while false {}")?;
engine.run("while false {}")?;
// Disable 'while' and make sure it still works with custom syntax
engine.disable_symbol("while");
@@ -79,7 +79,7 @@ fn test_custom_syntax() -> Result<(), Box<EvalAltResult>> {
assert!(matches!(
*engine
.consume("let foo = (exec [x<<15] -> { x += 2 } while x < 42) * 10;")
.run("let foo = (exec [x<<15] -> { x += 2 } while x < 42) * 10;")
.expect_err("should error"),
EvalAltResult::ErrorRuntime(_, _)
));