Change eval<()> to run.
This commit is contained in:
@@ -15,18 +15,16 @@ fn test_max_operations() -> Result<(), Box<EvalAltResult>> {
|
||||
None
|
||||
});
|
||||
|
||||
engine.eval::<()>("let x = 0; while x < 20 { x += 1; }")?;
|
||||
engine.run("let x = 0; while x < 20 { x += 1; }")?;
|
||||
|
||||
assert!(matches!(
|
||||
*engine
|
||||
.eval::<()>("for x in 0..500 {}")
|
||||
.expect_err("should error"),
|
||||
*engine.run("for x in 0..500 {}").expect_err("should error"),
|
||||
EvalAltResult::ErrorTooManyOperations(_)
|
||||
));
|
||||
|
||||
engine.set_max_operations(0);
|
||||
|
||||
engine.eval::<()>("for x in 0..10000 {}")?;
|
||||
engine.run("for x in 0..10000 {}")?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -43,7 +41,7 @@ fn test_max_operations_functions() -> Result<(), Box<EvalAltResult>> {
|
||||
None
|
||||
});
|
||||
|
||||
engine.eval::<()>(
|
||||
engine.run(
|
||||
r#"
|
||||
print("Test1");
|
||||
let x = 0;
|
||||
@@ -56,7 +54,7 @@ fn test_max_operations_functions() -> Result<(), Box<EvalAltResult>> {
|
||||
)?;
|
||||
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
engine.eval::<()>(
|
||||
engine.run(
|
||||
r#"
|
||||
print("Test2");
|
||||
fn inc(x) { x + 1 }
|
||||
@@ -68,7 +66,7 @@ fn test_max_operations_functions() -> Result<(), Box<EvalAltResult>> {
|
||||
#[cfg(not(feature = "no_function"))]
|
||||
assert!(matches!(
|
||||
*engine
|
||||
.eval::<()>(
|
||||
.run(
|
||||
r#"
|
||||
print("Test3");
|
||||
fn inc(x) { x + 1 }
|
||||
@@ -101,7 +99,7 @@ fn test_max_operations_eval() -> Result<(), Box<EvalAltResult>> {
|
||||
|
||||
assert!(matches!(
|
||||
*engine
|
||||
.eval::<()>(
|
||||
.run(
|
||||
r#"
|
||||
let script = "for x in 0..500 {}";
|
||||
eval(script);
|
||||
@@ -131,7 +129,7 @@ fn test_max_operations_progress() -> Result<(), Box<EvalAltResult>> {
|
||||
|
||||
assert!(matches!(
|
||||
*engine
|
||||
.eval::<()>("for x in 0..500 {}")
|
||||
.run("for x in 0..500 {}")
|
||||
.expect_err("should error"),
|
||||
EvalAltResult::ErrorTerminated(x, _) if x.as_int()? == 42
|
||||
));
|
||||
|
Reference in New Issue
Block a user