Use actual outer scope for function-bang calls.
This commit is contained in:
@@ -164,5 +164,22 @@ fn test_functions_bang() -> Result<(), Box<EvalAltResult>> {
|
||||
165
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
engine.eval::<INT>(
|
||||
"
|
||||
fn foo() {
|
||||
hello = 0;
|
||||
hello + bar
|
||||
}
|
||||
|
||||
let hello = 42;
|
||||
let bar = 123;
|
||||
|
||||
foo!()
|
||||
",
|
||||
)?,
|
||||
123
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@@ -204,8 +204,7 @@ fn test_function_pointers() -> Result<(), Box<EvalAltResult>> {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(feature = "no_closure"))]
|
||||
fn test_internal_fn_captures() -> Result<(), Box<EvalAltResult>> {
|
||||
fn test_internal_fn_bang() -> Result<(), Box<EvalAltResult>> {
|
||||
let engine = Engine::new();
|
||||
|
||||
assert_eq!(
|
||||
@@ -219,7 +218,7 @@ fn test_internal_fn_captures() -> Result<(), Box<EvalAltResult>> {
|
||||
foo!(1) + x
|
||||
"
|
||||
)?,
|
||||
83
|
||||
84
|
||||
);
|
||||
|
||||
assert!(engine
|
||||
|
Reference in New Issue
Block a user