Rewritten doxygen_parsing.cpptest according to the project plan
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13275 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
3a3c2b8063
commit
dc43241130
8 changed files with 207 additions and 107 deletions
|
|
@ -3,77 +3,119 @@
|
|||
%inline %{
|
||||
|
||||
/**
|
||||
* This is simple comment for a var
|
||||
* The class comment
|
||||
*/
|
||||
int simpleVar=42;
|
||||
/*!
|
||||
* This is another type of comment for a var
|
||||
*/
|
||||
int simpleVarTwo=42;
|
||||
|
||||
/// This is again another type of comment for a var
|
||||
int simpleVarThree=42;
|
||||
//! This is the last type of comment for a var
|
||||
int simpleVarFour=42;
|
||||
|
||||
int simpleVarFive=42;
|
||||
///< This is a post comment
|
||||
|
||||
/*
|
||||
We assume that all this comment types are ok,
|
||||
and later we only use the first-type comments.
|
||||
*/
|
||||
|
||||
class SomeClass
|
||||
{
|
||||
};
|
||||
|
||||
/**
|
||||
* This is simple comment for a function
|
||||
* The function comment
|
||||
*/
|
||||
void simpleFunction(int arg)
|
||||
void someFunction()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* This is simple comment for a class
|
||||
* The enum comment
|
||||
*/
|
||||
class CSimpleClass
|
||||
enum SomeEnum
|
||||
{
|
||||
private:
|
||||
/** Some member var */
|
||||
int simpleVar;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Simple method
|
||||
*/
|
||||
void simpleMethod(int asd)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* Simple method with parameter
|
||||
*/
|
||||
void simpleMethodWithParameter(
|
||||
int param, /**< Some test param */
|
||||
int argument /**< Some test argument */
|
||||
)
|
||||
{
|
||||
}
|
||||
SOME_ENUM_ITEM
|
||||
};
|
||||
|
||||
/**
|
||||
* Comment for template class
|
||||
* The struct comment
|
||||
*/
|
||||
template <typename T>
|
||||
class CTemplateClass
|
||||
struct SomeStruct
|
||||
{
|
||||
};
|
||||
|
||||
/**
|
||||
* The var comment
|
||||
*/
|
||||
int someVar=42;
|
||||
|
||||
class SomeAnotherClass
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Template method
|
||||
*/
|
||||
void templateMethod(T arg)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* The class attribute comment
|
||||
*/
|
||||
int classAttr;
|
||||
|
||||
int classAttr2; ///< The class attribute post-comment
|
||||
|
||||
int classAttr3; ///< The class attribute post-comment
|
||||
//!< with details
|
||||
|
||||
/**
|
||||
* The class method comment
|
||||
*/
|
||||
void classMethod()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* The class method with parameter
|
||||
*/
|
||||
void classMethodExtended(
|
||||
int a, ///< Parameter a
|
||||
int b ///< Parameter b
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* The class method with parameter
|
||||
*
|
||||
* @param a Parameter a
|
||||
* @param b Parameter b
|
||||
*/
|
||||
void classMethodExtended2(int a, int b)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct SomeAnotherStruct
|
||||
{
|
||||
/**
|
||||
* The struct attribute comment
|
||||
*/
|
||||
int structAttr;
|
||||
|
||||
int structAttr2; ///< The struct attribute post-comment
|
||||
|
||||
int structAttr3; ///< The struct attribute post-comment
|
||||
//!< with details
|
||||
|
||||
/**
|
||||
* The struct method comment
|
||||
*/
|
||||
void structMethod()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* The struct method with parameter
|
||||
*/
|
||||
void structMethodExtended(
|
||||
int a, ///< Parameter a
|
||||
int b ///< Parameter b
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* The struct method with parameter
|
||||
*
|
||||
* @param a Parameter a
|
||||
* @param b Parameter b
|
||||
*/
|
||||
void structMethodExtended2(int a, int b)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
%}
|
||||
|
||||
%template(CTemplateClassInt) CTemplateClass<int>;
|
||||
|
|
@ -3,13 +3,33 @@
|
|||
%inline %{
|
||||
|
||||
|
||||
/** Test enumeration */
|
||||
enum E_TEST
|
||||
{
|
||||
/** the first item */
|
||||
E_TEST_ONE,
|
||||
E_TEST_TWO = 2, /**< the second */
|
||||
E_TEST_THREE = 2+1 /**< the last item */
|
||||
};
|
||||
/**
|
||||
* Testing comments before enum items
|
||||
*/
|
||||
enum SomeAnotherEnum
|
||||
{
|
||||
/**
|
||||
* The comment for the first item
|
||||
*/
|
||||
SOME_ITEM_1,
|
||||
/**
|
||||
* The comment for the second item
|
||||
*/
|
||||
SOME_ITEM_2,
|
||||
/**
|
||||
* The comment for the third item
|
||||
*/
|
||||
SOME_ITEM_3
|
||||
};
|
||||
|
||||
/**
|
||||
* Testing comments after enum items
|
||||
*/
|
||||
enum SomeAnotherEnum2
|
||||
{
|
||||
SOME_ITEM_10, ///< Post comment for the first item
|
||||
SOME_ITEM_20, ///< Post comment for the second item
|
||||
SOME_ITEM_30 ///< Post comment for the third item
|
||||
};
|
||||
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -25,10 +25,14 @@ public class doxygen_parsing_enums_proper_runme {
|
|||
|
||||
HashMap<String, String> wantedComments = new HashMap<String, String>();
|
||||
|
||||
wantedComments.put("E_TEST", " Test enumeration \n");
|
||||
wantedComments.put("E_TEST_ONE", " the first item \n");
|
||||
wantedComments.put("E_TEST_TWO", " the second \n");
|
||||
wantedComments.put("E_TEST_THREE", " the last item \n");
|
||||
wantedComments.put("SomeAnotherEnum", " Testing comments before enum items \n");
|
||||
wantedComments.put("SOME_ITEM_1", " The comment for the first item \n");
|
||||
wantedComments.put("SOME_ITEM_2", " The comment for the second item \n");
|
||||
wantedComments.put("SOME_ITEM_3", " The comment for the third item \n");
|
||||
wantedComments.put("SomeAnotherEnum2", " Testing comments after enum items \n");
|
||||
wantedComments.put("SOME_ITEM_10", " Post comment for the first item \n");
|
||||
wantedComments.put("SOME_ITEM_20", " Post comment for the second item \n");
|
||||
wantedComments.put("SOME_ITEM_30", " Post comment for the third item \n");
|
||||
|
||||
// and ask the parser to check comments for us
|
||||
System.exit(parser.check(wantedComments));
|
||||
|
|
|
|||
|
|
@ -25,9 +25,12 @@ public class doxygen_parsing_enums_simple_runme {
|
|||
|
||||
HashMap<String, String> wantedComments = new HashMap<String, String>();
|
||||
|
||||
wantedComments.put("E_TEST_ONE", " the first item \n");
|
||||
wantedComments.put("E_TEST_TWO", " the second \n");
|
||||
wantedComments.put("E_TEST_THREE", " the last item \n");
|
||||
wantedComments.put("SOME_ITEM_1", " The comment for the first item \n");
|
||||
wantedComments.put("SOME_ITEM_2", " The comment for the second item \n");
|
||||
wantedComments.put("SOME_ITEM_3", " The comment for the third item \n");
|
||||
wantedComments.put("SOME_ITEM_10", " Post comment for the first item \n");
|
||||
wantedComments.put("SOME_ITEM_20", " Post comment for the second item \n");
|
||||
wantedComments.put("SOME_ITEM_30", " Post comment for the third item \n");
|
||||
|
||||
// and ask the parser to check comments for us
|
||||
System.exit(parser.check(wantedComments));
|
||||
|
|
|
|||
|
|
@ -25,10 +25,14 @@ public class doxygen_parsing_enums_typesafe_runme {
|
|||
|
||||
HashMap<String, String> wantedComments = new HashMap<String, String>();
|
||||
|
||||
wantedComments.put("E_TEST", " Test enumeration \n");
|
||||
wantedComments.put("E_TEST_ONE", " the first item \n");
|
||||
wantedComments.put("E_TEST_TWO", " the second \n");
|
||||
wantedComments.put("E_TEST_THREE", " the last item \n");
|
||||
wantedComments.put("SomeAnotherEnum", " Testing comments before enum items \n");
|
||||
wantedComments.put("SOME_ITEM_1", " The comment for the first item \n");
|
||||
wantedComments.put("SOME_ITEM_2", " The comment for the second item \n");
|
||||
wantedComments.put("SOME_ITEM_3", " The comment for the third item \n");
|
||||
wantedComments.put("SomeAnotherEnum2", " Testing comments after enum items \n");
|
||||
wantedComments.put("SOME_ITEM_10", " Post comment for the first item \n");
|
||||
wantedComments.put("SOME_ITEM_20", " Post comment for the second item \n");
|
||||
wantedComments.put("SOME_ITEM_30", " Post comment for the third item \n");
|
||||
|
||||
// and ask the parser to check comments for us
|
||||
System.exit(parser.check(wantedComments));
|
||||
|
|
|
|||
|
|
@ -25,10 +25,14 @@ public class doxygen_parsing_enums_typeunsafe_runme {
|
|||
|
||||
HashMap<String, String> wantedComments = new HashMap<String, String>();
|
||||
|
||||
wantedComments.put("E_TEST", " Test enumeration \n");
|
||||
wantedComments.put("E_TEST_ONE", " the first item \n");
|
||||
wantedComments.put("E_TEST_TWO", " the second \n");
|
||||
wantedComments.put("E_TEST_THREE", " the last item \n");
|
||||
wantedComments.put("SomeAnotherEnum", " Testing comments before enum items \n");
|
||||
wantedComments.put("SOME_ITEM_1", " The comment for the first item \n");
|
||||
wantedComments.put("SOME_ITEM_2", " The comment for the second item \n");
|
||||
wantedComments.put("SOME_ITEM_3", " The comment for the third item \n");
|
||||
wantedComments.put("SomeAnotherEnum2", " Testing comments after enum items \n");
|
||||
wantedComments.put("SOME_ITEM_10", " Post comment for the first item \n");
|
||||
wantedComments.put("SOME_ITEM_20", " Post comment for the second item \n");
|
||||
wantedComments.put("SOME_ITEM_30", " Post comment for the third item \n");
|
||||
|
||||
// and ask the parser to check comments for us
|
||||
System.exit(parser.check(wantedComments));
|
||||
|
|
|
|||
|
|
@ -25,26 +25,30 @@ public class doxygen_parsing_runme {
|
|||
|
||||
HashMap<String, String> wantedComments = new HashMap<String, String>();
|
||||
|
||||
wantedComments.put("simpleFunction", " This is simple comment for a function \n");
|
||||
|
||||
wantedComments.put("CSimpleClass", " This is simple comment for a class \n");
|
||||
wantedComments.put("simpleMethod", " Simple method \n");
|
||||
wantedComments.put("simpleMethodWithParameter", " Simple method with parameter \n" +
|
||||
" @param\tparam Some test param \n" +
|
||||
" @param\targument Some test argument \n");
|
||||
wantedComments.put("CTemplateClassInt", " Comment for template class \n");
|
||||
wantedComments.put("templateMethod", " Template method \n");
|
||||
|
||||
wantedComments.put("setSimpleVar", " This is simple comment for a var \n");
|
||||
wantedComments.put("getSimpleVar", " This is simple comment for a var \n");
|
||||
wantedComments.put("setSimpleVarTwo", " This is another type of comment for a var \n");
|
||||
wantedComments.put("getSimpleVarTwo", " This is another type of comment for a var \n");
|
||||
wantedComments.put("setSimpleVarThree", " This is again another type of comment for a var \n");
|
||||
wantedComments.put("getSimpleVarThree", " This is again another type of comment for a var \n");
|
||||
wantedComments.put("setSimpleVarFour", " This is the last type of comment for a var \n");
|
||||
wantedComments.put("getSimpleVarFour", " This is the last type of comment for a var \n");
|
||||
wantedComments.put("setSimpleVarFive", " This is a post comment \n");
|
||||
wantedComments.put("getSimpleVarFive", " This is a post comment \n");
|
||||
wantedComments.put("someFunction", " The function comment \n");
|
||||
wantedComments.put("SomeEnum", " The enum comment \n");
|
||||
wantedComments.put("setSomeVar", " The var comment \n");
|
||||
wantedComments.put("getSomeVar", " The var comment \n");
|
||||
wantedComments.put("SomeClass", " The class comment \n");
|
||||
wantedComments.put("setClassAttr", " The class attribute comment \n");
|
||||
wantedComments.put("getClassAttr", " The class attribute comment \n");
|
||||
wantedComments.put("setClassAttr2", " The class attribute post-comment \n");
|
||||
wantedComments.put("getClassAttr2", " The class attribute post-comment \n");
|
||||
wantedComments.put("setClassAttr3", " The class attribute post-comment with details \n");
|
||||
wantedComments.put("getClassAttr3", " The class attribute post-comment with details \n");
|
||||
wantedComments.put("classMethod", " The class method comment \n");
|
||||
wantedComments.put("classMethodExtended", " The class method with parameter \n @param a Parameter a \n @param b Parameter b \n");
|
||||
wantedComments.put("classMethodExtended2", " The class method with parameter \n @param a Parameter a \n @param b Parameter b \n");
|
||||
wantedComments.put("SomeStruct", " The struct comment \n");
|
||||
wantedComments.put("setStructAttr", " The struct attribute comment \n");
|
||||
wantedComments.put("getStructAttr", " The struct attribute comment \n");
|
||||
wantedComments.put("setStructAttr2", " The struct attribute post-comment \n");
|
||||
wantedComments.put("getStructAttr2", " The struct attribute post-comment \n");
|
||||
wantedComments.put("setStructAttr3", " The struct attribute post-comment with details \n");
|
||||
wantedComments.put("getStructAttr3", " The struct attribute post-comment with details \n");
|
||||
wantedComments.put("structMethod", " The struct method comment \n");
|
||||
wantedComments.put("structMethodExtended", " The struct method with parameter \n @param a Parameter a \n @param b Parameter b \n");
|
||||
wantedComments.put("structMethodExtended2", " The struct method with parameter \n @param a Parameter a \n @param b Parameter b \n");
|
||||
|
||||
// and ask the parser to check comments for us
|
||||
System.exit(parser.check(wantedComments));
|
||||
|
|
|
|||
|
|
@ -8,13 +8,32 @@ def check(got, expected):
|
|||
if not re.match(str(expected), str(got)):
|
||||
raise RuntimeError("\n" + "Expected: [" + str(expected) + "]\n" + "Got : [" + str(got) + "]")
|
||||
|
||||
check(doxygen_parsing.simpleFunction.__doc__, '\s+This is simple comment for a function\s+')
|
||||
check(doxygen_parsing.CSimpleClass.__doc__, '\s+This is simple comment for a class\s+')
|
||||
check(doxygen_parsing.CSimpleClass.simpleMethod.__doc__, '\s+Simple method\s+')
|
||||
check(doxygen_parsing.CSimpleClass.simpleMethodWithParameter.__doc__, ''
|
||||
'\s+Simple method with parameter'
|
||||
'\s+Arguments:\s+param \(int\)\s+-- Some test param\s+'
|
||||
'argument \(int\)\s+-- Some test argument\s+'
|
||||
check(doxygen_parsing.someFunction.__doc__, '\s+The function comment\s+')
|
||||
check(doxygen_parsing.SomeClass.__doc__, '\s+The class comment\s+')
|
||||
check(doxygen_parsing.SomeStruct.__doc__, '\s+The struct comment\s+')
|
||||
check(doxygen_parsing.SomeAnotherClass.classMethod.__doc__, '\s+The class method comment\s+')
|
||||
check(doxygen_parsing.SomeAnotherClass.classMethodExtended.__doc__, ''
|
||||
'\s+The class method with parameter'
|
||||
'\s+Arguments:\s+'
|
||||
'a \(int\)\s+-- Parameter a\s+'
|
||||
'b \(int\)\s+-- Parameter b\s+'
|
||||
)
|
||||
check(doxygen_parsing.CTemplateClassInt.__doc__, '\s+Comment for template class\s+')
|
||||
check(doxygen_parsing.CTemplateClassInt.templateMethod.__doc__, '\s+Template method\s+')
|
||||
check(doxygen_parsing.SomeAnotherClass.classMethodExtended2.__doc__, ''
|
||||
'\s+The class method with parameter'
|
||||
'\s+Arguments:\s+'
|
||||
'a \(int\)\s+-- Parameter a\s+'
|
||||
'b \(int\)\s+-- Parameter b\s+'
|
||||
)
|
||||
check(doxygen_parsing.SomeAnotherStruct.structMethod.__doc__, '\s+The struct method comment\s+')
|
||||
check(doxygen_parsing.SomeAnotherStruct.structMethodExtended.__doc__, ''
|
||||
'\s+The struct method with parameter'
|
||||
'\s+Arguments:\s+'
|
||||
'a \(int\)\s+-- Parameter a\s+'
|
||||
'b \(int\)\s+-- Parameter b\s+'
|
||||
)
|
||||
check(doxygen_parsing.SomeAnotherStruct.structMethodExtended2.__doc__, ''
|
||||
'\s+The struct method with parameter'
|
||||
'\s+Arguments:\s+'
|
||||
'a \(int\)\s+-- Parameter a\s+'
|
||||
'b \(int\)\s+-- Parameter b\s+'
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue