Fixed exception bug

release/4.3a0
dellaert 2014-11-12 23:54:37 +01:00
parent 1ea0225030
commit 5ca71a2eb9
2 changed files with 15 additions and 6 deletions

View File

@ -31,16 +31,14 @@ using namespace wrap;
/* ************************************************************************* */
void Method::addOverload(bool verbose, bool is_const, const std::string& name,
const ArgumentList& args, const ReturnValue& retVal) {
#ifdef ADD_OVERLOAD_CHECK_NAME
if (!name.empty() && this->name != name)
if (!this->name.empty() && this->name != name)
throw std::runtime_error(
"Method::addOverload: tried to add overload with name " + name
+ " instead of expected " + this->name);
#endif
this->name = name;
else
this->name = name;
this->verbose_ = verbose;
this->is_const_ = is_const;
this->name = name;
this->argLists.push_back(args);
this->returnVals.push_back(retVal);
}

View File

@ -33,14 +33,25 @@ TEST( Class, Constructor ) {
// addMethodOverloads
TEST( Class, addMethod ) {
Class cls;
const string name = "method1";
EXPECT(!cls.exists(name));
bool verbose=true, is_const=true;
const string name;
ArgumentList args;
const ReturnValue retVal;
const string templateArgName;
vector<Qualified> templateArgValues;
cls.addMethod(verbose, is_const, name, args, retVal, templateArgName,
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());
}
/* ************************************************************************* */