diff --git a/tests/call_fn.rs b/tests/call_fn.rs index 7e9170b0..7b959472 100644 --- a/tests/call_fn.rs +++ b/tests/call_fn.rs @@ -38,6 +38,10 @@ fn test_call_fn() -> Result<(), Box> { fn hello() { 41 + foo } + fn define_var() { + let bar = 21; + bar * 2 + } ", )?; @@ -50,6 +54,11 @@ fn test_call_fn() -> Result<(), Box> { let r: INT = engine.call_fn(&mut scope, &ast, "hello", ())?; assert_eq!(r, 42); + let r: INT = engine.call_fn(&mut scope, &ast, "define_var", ())?; + assert_eq!(r, 42); + + assert!(!scope.contains("bar")); + assert_eq!( scope .get_value::("foo")