diff --git a/unittests/compiled_tests.cpp b/unittests/compiled_tests.cpp index 9e344cc..9d1df58 100644 --- a/unittests/compiled_tests.cpp +++ b/unittests/compiled_tests.cpp @@ -776,4 +776,12 @@ TEST_CASE("Variable Scope When Calling From C++") CHECK_THROWS(func()); } +TEST_CASE("Variable Scope When Calling From C++ 2") +{ + chaiscript::ChaiScript chai; + chai.eval("var obj = 2;"); + auto func = chai.eval>("fun(){ return obj; }"); + CHECK_THROWS(func()); +} +