From 179eaefafe371ef71c01febb8050df8de964f51a Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Tue, 25 Aug 2015 17:10:45 -0600 Subject: [PATCH] Add failing test for functor scope --- unittests/compiled_tests.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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()); +} +