Add no_function
feature to disable script-defined functions.
This commit is contained in:
@@ -39,10 +39,9 @@ fn test_bool_op_short_circuit() -> Result<(), EvalAltResult> {
|
||||
assert_eq!(
|
||||
engine.eval::<bool>(
|
||||
r"
|
||||
fn this() { true }
|
||||
fn that() { 9/0 }
|
||||
let this = true;
|
||||
|
||||
this() || that();
|
||||
this || { throw; };
|
||||
"
|
||||
)?,
|
||||
true
|
||||
@@ -51,10 +50,9 @@ fn test_bool_op_short_circuit() -> Result<(), EvalAltResult> {
|
||||
assert_eq!(
|
||||
engine.eval::<bool>(
|
||||
r"
|
||||
fn this() { false }
|
||||
fn that() { 9/0 }
|
||||
let this = false;
|
||||
|
||||
this() && that();
|
||||
this && { throw; };
|
||||
"
|
||||
)?,
|
||||
false
|
||||
@@ -72,10 +70,9 @@ fn test_bool_op_no_short_circuit1() {
|
||||
engine
|
||||
.eval::<bool>(
|
||||
r"
|
||||
fn this() { false }
|
||||
fn that() { 9/0 }
|
||||
let this = true;
|
||||
|
||||
this() | that();
|
||||
this | { throw; }
|
||||
"
|
||||
)
|
||||
.unwrap(),
|
||||
@@ -92,10 +89,9 @@ fn test_bool_op_no_short_circuit2() {
|
||||
engine
|
||||
.eval::<bool>(
|
||||
r"
|
||||
fn this() { false }
|
||||
fn that() { 9/0 }
|
||||
let this = false;
|
||||
|
||||
this() & that();
|
||||
this & { throw; }
|
||||
"
|
||||
)
|
||||
.unwrap(),
|
||||
|
Reference in New Issue
Block a user