From 6b27ca19d52ec6d4a4d85e4bd470410e79771ade Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Wed, 10 Nov 2021 22:10:03 +0800 Subject: [PATCH] Add function call bang test. --- tests/functions.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/functions.rs b/tests/functions.rs index e0b4af5a..3132907d 100644 --- a/tests/functions.rs +++ b/tests/functions.rs @@ -143,3 +143,26 @@ fn test_functions_global_module() -> Result<(), Box> { Ok(()) } + +#[test] +fn test_functions_bang() -> Result<(), Box> { + let engine = Engine::new(); + + assert_eq!( + engine.eval::( + " + fn foo() { + hello + bar + } + + let hello = 42; + let bar = 123; + + foo!() + ", + )?, + 165 + ); + + Ok(()) +}