diff --git a/wrap/Module.cpp b/wrap/Module.cpp index e45c09672..4fc53268c 100644 --- a/wrap/Module.cpp +++ b/wrap/Module.cpp @@ -349,29 +349,29 @@ void Module::parseMarkup(const std::string& data) { Rule module_p = *module_content_p >> !end_p; - //---------------------------------------------------------------------------- - // for debugging, define BOOST_SPIRIT_DEBUG -# ifdef BOOST_SPIRIT_DEBUG - BOOST_SPIRIT_DEBUG_NODE(className_p); - BOOST_SPIRIT_DEBUG_NODE(classPtr_p); - BOOST_SPIRIT_DEBUG_NODE(classRef_p); - BOOST_SPIRIT_DEBUG_NODE(basisType_p); - BOOST_SPIRIT_DEBUG_NODE(name_p); - BOOST_SPIRIT_DEBUG_NODE(argument_p); - BOOST_SPIRIT_DEBUG_NODE(argumentList_p); - BOOST_SPIRIT_DEBUG_NODE(constructor_p); - BOOST_SPIRIT_DEBUG_NODE(returnType1_p); - BOOST_SPIRIT_DEBUG_NODE(returnType2_p); - BOOST_SPIRIT_DEBUG_NODE(pair_p); - BOOST_SPIRIT_DEBUG_NODE(void_p); - BOOST_SPIRIT_DEBUG_NODE(returnType_p); - BOOST_SPIRIT_DEBUG_NODE(methodName_p); - BOOST_SPIRIT_DEBUG_NODE(method_p); - BOOST_SPIRIT_DEBUG_NODE(class_p); - BOOST_SPIRIT_DEBUG_NODE(namespace_def_p); - BOOST_SPIRIT_DEBUG_NODE(module_p); -# endif - //---------------------------------------------------------------------------- +// //---------------------------------------------------------------------------- +// // for debugging, define BOOST_SPIRIT_DEBUG +//# ifdef BOOST_SPIRIT_DEBUG +// BOOST_SPIRIT_DEBUG_NODE(className_p); +// BOOST_SPIRIT_DEBUG_NODE(classPtr_p); +// BOOST_SPIRIT_DEBUG_NODE(classRef_p); +// BOOST_SPIRIT_DEBUG_NODE(basisType_p); +// BOOST_SPIRIT_DEBUG_NODE(name_p); +// BOOST_SPIRIT_DEBUG_NODE(argument_p); +// BOOST_SPIRIT_DEBUG_NODE(argumentList_p); +// BOOST_SPIRIT_DEBUG_NODE(constructor_p); +// BOOST_SPIRIT_DEBUG_NODE(returnType1_p); +// BOOST_SPIRIT_DEBUG_NODE(returnType2_p); +// BOOST_SPIRIT_DEBUG_NODE(pair_p); +// BOOST_SPIRIT_DEBUG_NODE(void_p); +// BOOST_SPIRIT_DEBUG_NODE(returnType_p); +// BOOST_SPIRIT_DEBUG_NODE(methodName_p); +// BOOST_SPIRIT_DEBUG_NODE(method_p); +// BOOST_SPIRIT_DEBUG_NODE(class_p); +// BOOST_SPIRIT_DEBUG_NODE(namespace_def_p); +// BOOST_SPIRIT_DEBUG_NODE(module_p); +//# endif +// //---------------------------------------------------------------------------- // and parse contents parse_info info = parse(data.c_str(), module_p, space_p); diff --git a/wrap/tests/testWrap.cpp b/wrap/tests/testWrap.cpp index efb3912c9..803287a23 100644 --- a/wrap/tests/testWrap.cpp +++ b/wrap/tests/testWrap.cpp @@ -78,8 +78,9 @@ TEST( wrap, small_parse ) { string markup( string("class Point2 { \n") + string(" double x() const; \n") + // Method 1 - string(" Matrix returnChar() const; \n") + // Method 2 + string(" Matrix returnMatrix() const; \n") + // Method 2 string(" Point2 returnPoint2() const; \n") + // Method 3 + string(" static Vector returnVector(); \n") + // Static Method 1 string("};\n")); module.parseMarkup(markup); @@ -89,8 +90,8 @@ TEST( wrap, small_parse ) { EXPECT(assert_equal("Point2", cls.name)); EXPECT(!cls.isVirtual); EXPECT(cls.namespaces.empty()); - EXPECT(cls.static_methods.empty()); LONGS_EQUAL(3, cls.methods.size()); + LONGS_EQUAL(1, cls.static_methods.size()); // Method 1 Method m1 = cls.methods.at("x"); @@ -106,8 +107,8 @@ TEST( wrap, small_parse ) { EXPECT_LONGS_EQUAL(ReturnValue::BASIS, rv1.category1); // Method 2 - Method m2 = cls.methods.at("returnChar"); - EXPECT(assert_equal("returnChar", m2.name)); + Method m2 = cls.methods.at("returnMatrix"); + EXPECT(assert_equal("returnMatrix", m2.name)); EXPECT(m2.is_const_); LONGS_EQUAL(1, m2.argLists.size()); LONGS_EQUAL(1, m2.returnVals.size()); @@ -131,6 +132,19 @@ TEST( wrap, small_parse ) { EXPECT(assert_equal("Point2", rv3.type1)); EXPECT_LONGS_EQUAL(ReturnValue::CLASS, rv3.category1); + // Static Method 1 + // static Vector returnVector(); + StaticMethod sm1 = cls.static_methods.at("returnVector"); + EXPECT(assert_equal("returnVector", sm1.name)); + LONGS_EQUAL(1, sm1.argLists.size()); + LONGS_EQUAL(1, sm1.returnVals.size()); + + ReturnValue rv4 = sm1.returnVals.front(); + EXPECT(!rv4.isPair); + EXPECT(!rv4.isPtr1); + EXPECT(assert_equal("Vector", rv4.type1)); + EXPECT_LONGS_EQUAL(ReturnValue::EIGEN, rv4.category1); + } /* ************************************************************************* */