Fixed exception bug
parent
1ea0225030
commit
5ca71a2eb9
|
@ -31,16 +31,14 @@ using namespace wrap;
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void Method::addOverload(bool verbose, bool is_const, const std::string& name,
|
void Method::addOverload(bool verbose, bool is_const, const std::string& name,
|
||||||
const ArgumentList& args, const ReturnValue& retVal) {
|
const ArgumentList& args, const ReturnValue& retVal) {
|
||||||
#ifdef ADD_OVERLOAD_CHECK_NAME
|
if (!this->name.empty() && this->name != name)
|
||||||
if (!name.empty() && this->name != name)
|
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
"Method::addOverload: tried to add overload with name " + name
|
"Method::addOverload: tried to add overload with name " + name
|
||||||
+ " instead of expected " + this->name);
|
+ " instead of expected " + this->name);
|
||||||
#endif
|
else
|
||||||
this->name = name;
|
this->name = name;
|
||||||
this->verbose_ = verbose;
|
this->verbose_ = verbose;
|
||||||
this->is_const_ = is_const;
|
this->is_const_ = is_const;
|
||||||
this->name = name;
|
|
||||||
this->argLists.push_back(args);
|
this->argLists.push_back(args);
|
||||||
this->returnVals.push_back(retVal);
|
this->returnVals.push_back(retVal);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,14 +33,25 @@ TEST( Class, Constructor ) {
|
||||||
// addMethodOverloads
|
// addMethodOverloads
|
||||||
TEST( Class, addMethod ) {
|
TEST( Class, addMethod ) {
|
||||||
Class cls;
|
Class cls;
|
||||||
|
const string name = "method1";
|
||||||
|
EXPECT(!cls.exists(name));
|
||||||
|
|
||||||
bool verbose=true, is_const=true;
|
bool verbose=true, is_const=true;
|
||||||
const string name;
|
|
||||||
ArgumentList args;
|
ArgumentList args;
|
||||||
const ReturnValue retVal;
|
const ReturnValue retVal;
|
||||||
const string templateArgName;
|
const string templateArgName;
|
||||||
vector<Qualified> templateArgValues;
|
vector<Qualified> templateArgValues;
|
||||||
cls.addMethod(verbose, is_const, name, args, retVal, templateArgName,
|
cls.addMethod(verbose, is_const, name, args, retVal, templateArgName,
|
||||||
templateArgValues);
|
templateArgValues);
|
||||||
|
EXPECT_LONGS_EQUAL(1,cls.nrMethods());
|
||||||
|
EXPECT(cls.exists(name));
|
||||||
|
Method& method = cls.method(name);
|
||||||
|
EXPECT_LONGS_EQUAL(1,method.returnVals.size());
|
||||||
|
|
||||||
|
cls.addMethod(verbose, is_const, name, args, retVal, templateArgName,
|
||||||
|
templateArgValues);
|
||||||
|
EXPECT_LONGS_EQUAL(1,cls.nrMethods());
|
||||||
|
EXPECT_LONGS_EQUAL(2,method.returnVals.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
Loading…
Reference in New Issue