mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 15:44:11 +02:00
parent
a82b55bcc6
commit
e3dcc8a610
@ -44,7 +44,7 @@ public:
|
|||||||
|
|
||||||
Function(const Callback& function);
|
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);
|
static Object::Ptr GetPrototype(void);
|
||||||
|
|
||||||
|
@ -184,8 +184,7 @@ Value MacroProcessor::EvaluateFunction(const Function::Ptr& func, const Resolver
|
|||||||
recursionLevel)));
|
recursionLevel)));
|
||||||
|
|
||||||
ScriptFrame frame(resolvers_this);
|
ScriptFrame frame(resolvers_this);
|
||||||
std::vector<Value> args;
|
return func->Invoke();
|
||||||
return func->Invoke(args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Value MacroProcessor::InternalResolveMacros(const String& str, const ResolverList& resolvers,
|
Value MacroProcessor::InternalResolveMacros(const String& str, const ResolverList& resolvers,
|
||||||
|
@ -209,6 +209,7 @@ BOOST_AUTO_TEST_CASE(advanced)
|
|||||||
{
|
{
|
||||||
ScriptFrame frame;
|
ScriptFrame frame;
|
||||||
Expression *expr;
|
Expression *expr;
|
||||||
|
Function::Ptr func;
|
||||||
|
|
||||||
expr = ConfigCompiler::CompileText("<test>", "regex(\"^Hello\", \"Hello World\")");
|
expr = ConfigCompiler::CompileText("<test>", "regex(\"^Hello\", \"Hello World\")");
|
||||||
BOOST_CHECK(expr->Evaluate(frame));
|
BOOST_CHECK(expr->Evaluate(frame));
|
||||||
@ -319,6 +320,11 @@ BOOST_AUTO_TEST_CASE(advanced)
|
|||||||
expr = ConfigCompiler::CompileText("<test>", "Array.x");
|
expr = ConfigCompiler::CompileText("<test>", "Array.x");
|
||||||
BOOST_CHECK_THROW(expr->Evaluate(frame), ScriptError);
|
BOOST_CHECK_THROW(expr->Evaluate(frame), ScriptError);
|
||||||
delete expr;
|
delete expr;
|
||||||
|
|
||||||
|
expr = ConfigCompiler::CompileText("<test>", "{{ 3 }}");
|
||||||
|
func = expr->Evaluate(frame);
|
||||||
|
BOOST_CHECK(func->Invoke() == 3);
|
||||||
|
delete expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user