new feature: define and call functions using the two new commands function and call
This commit is contained in:
1 parent
332db8b079
commit
2c12481418
3 files changed
+204
-36
No files matched your search
@@ -219,4 +219,31 @@ class ScriptExecutionFailed: public ScriptFailed {
|
||||
}
|
||||
};
|
||||
|
||||
class WrongNumberOfArguments: public TestFailed {
|
||||
public:
|
||||
WrongNumberOfArguments(QString name, QStringList vars, QStringList args):
|
||||
TestFailed(QString("%1 has %2 arguments, but %3 were given")
|
||||
.arg(name).arg(vars.size()).arg(args.size())) {
|
||||
}
|
||||
};
|
||||
|
||||
class FunctionCallFailed: public TestFailed {
|
||||
public:
|
||||
FunctionCallFailed(QString name, QStringList vars, QStringList args,
|
||||
const std::exception& x):
|
||||
TestFailed("function call failed: "+name) {
|
||||
for (QStringList::iterator var(vars.begin()), arg(args.begin());
|
||||
var<vars.end() && arg<args.end(); ++var, ++arg)
|
||||
_what += " "+*var+"="+*arg;
|
||||
_what += QString("; reason: ")+x.what();
|
||||
}
|
||||
};
|
||||
|
||||
class FunctionNotFound: public TestFailed {
|
||||
public:
|
||||
FunctionNotFound(QString name):
|
||||
TestFailed("function not found: "+name) {
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user