Implement a unit test for nullary lambdas

fixes #7805
This commit is contained in:
Gunnar Beutner 2015-02-03 14:02:32 +01:00
parent a82b55bcc6
commit e3dcc8a610
3 changed files with 8 additions and 3 deletions

View File

@ -44,7 +44,7 @@ public:
Function(const Callback& function);
Value Invoke(const std::vector<Value>& arguments);
Value Invoke(const std::vector<Value>& arguments = std::vector<Value>());
static Object::Ptr GetPrototype(void);

View File

@ -184,8 +184,7 @@ Value MacroProcessor::EvaluateFunction(const Function::Ptr& func, const Resolver
recursionLevel)));
ScriptFrame frame(resolvers_this);
std::vector<Value> args;
return func->Invoke(args);
return func->Invoke();
}
Value MacroProcessor::InternalResolveMacros(const String& str, const ResolverList& resolvers,

View File

@ -209,6 +209,7 @@ BOOST_AUTO_TEST_CASE(advanced)
{
ScriptFrame frame;
Expression *expr;
Function::Ptr func;
expr = ConfigCompiler::CompileText("<test>", "regex(\"^Hello\", \"Hello World\")");
BOOST_CHECK(expr->Evaluate(frame));
@ -319,6 +320,11 @@ BOOST_AUTO_TEST_CASE(advanced)
expr = ConfigCompiler::CompileText("<test>", "Array.x");
BOOST_CHECK_THROW(expr->Evaluate(frame), ScriptError);
delete expr;
expr = ConfigCompiler::CompileText("<test>", "{{ 3 }}");
func = expr->Evaluate(frame);
BOOST_CHECK(func->Invoke() == 3);
delete expr;
}
BOOST_AUTO_TEST_SUITE_END()