@@ -20,6 +20,12 @@ def __init__(self, *args):
20
20
self .global_ns = None
21
21
self .config .castxml_epic_version = 1
22
22
23
+ def _check_comment_content (self , list , comment_decl ):
24
+ if comment_decl .text :
25
+ self .assertEqual (list , comment_decl .text )
26
+ else :
27
+ print ("No text in comment to check" )
28
+
23
29
def setUp (self ):
24
30
25
31
if not self .global_ns :
@@ -41,47 +47,40 @@ def test(self):
41
47
tnamespace = self .global_ns .namespace ("comment" )
42
48
43
49
self .assertIn ("comment" , dir (tnamespace ))
44
- if tnamespace .comment .text :
45
- self .assertEqual (["//! Namespace Comment" ,
46
- "//! Across multiple lines" ],
47
- tnamespace .comment .text )
50
+ self ._check_comment_content (["//! Namespace Comment" ,
51
+ "//! Across multiple lines" ],
52
+ tnamespace .comment )
48
53
49
54
tenumeration = tnamespace .enumeration ("com_enum" )
50
55
self .assertIn ("comment" , dir (tenumeration ))
51
- if tenumeration .comment .text :
52
- self .assertEqual (['/// Outside Class enum comment' ],
53
- tenumeration .comment .text )
56
+ self ._check_comment_content (['/// Outside Class enum comment' ],
57
+ tenumeration .comment )
54
58
55
59
tclass = tnamespace .class_ ("test" )
56
60
self .assertIn ("comment" , dir (tclass ))
57
- if tclass .comment .text :
58
- self .assertEqual (["/** class comment */" ], tclass .comment .text )
61
+ self ._check_comment_content (["/** class comment */" ], tclass .comment )
59
62
60
63
tcls_enumeration = tclass .enumeration ("test_enum" )
61
64
self .assertIn ("comment" , dir (tcls_enumeration ))
62
- if tcls_enumeration .comment .text :
63
- self .assertEqual (['/// inside class enum comment' ],
64
- tcls_enumeration .comment .text )
65
+ self ._check_comment_content (['/// inside class enum comment' ],
66
+ tcls_enumeration .comment )
65
67
66
68
tmethod = tclass .member_functions ()[0 ]
67
69
68
70
self .assertIn ("comment" , dir (tmethod ))
69
- if tmethod .comment .text :
70
- self .assertEqual (["/// cxx comment" , "/// with multiple lines" ],
71
- tmethod .comment .text )
71
+ self ._check_comment_content (["/// cxx comment" , "/// with multiple lines" ],
72
+ tmethod .comment )
72
73
73
74
tconstructor = tclass .constructors ()[0 ]
74
75
75
76
self .assertIn ("comment" , dir (tconstructor ))
76
- if tconstructor .comment .text :
77
- self .assertEqual (["/** doc comment */" ], tconstructor .comment .text )
77
+ self ._check_comment_content (["/** doc comment */" ], tconstructor .comment )
78
78
79
79
for indx , cmt in enumerate (['//! mutable field comment' ,
80
80
"/// bit field comment" ]):
81
81
tvariable = tclass .variables ()[indx ]
82
82
self .assertIn ("comment" , dir (tvariable ))
83
- if tvariable .comment .text :
84
- self .assertEqual ([cmt ], tvariable .comment .text )
83
+ self ._check_comment_content ([cmt ], tvariable .comment )
85
84
86
85
87
86
def create_suite ():
0 commit comments