mirror of https://github.com/Icinga/icinga2.git
parent
a82b55bcc6
commit
e3dcc8a610
|
@ -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);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue