From: <rom...@us...> - 2008-06-11 19:20:23
|
Revision: 1328 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1328&view=rev Author: roman_yakovenko Date: 2008-06-11 12:20:30 -0700 (Wed, 11 Jun 2008) Log Message: ----------- few bug fixes, after upgrading to latest gccxml version Modified Paths: -------------- pygccxml_dev/unittests/filters_tester.py Modified: pygccxml_dev/unittests/filters_tester.py =================================================================== --- pygccxml_dev/unittests/filters_tester.py 2008-06-11 19:20:02 UTC (rev 1327) +++ pygccxml_dev/unittests/filters_tester.py 2008-06-11 19:20:30 UTC (rev 1328) @@ -13,27 +13,33 @@ from pygccxml import declarations class tester_t( parser_test_case.parser_test_case_t ): + global_ns = None COMPILATION_MODE = parser.COMPILATION_MODE.ALL_AT_ONCE def __init__(self, *args ): parser_test_case.parser_test_case_t.__init__( self, *args ) self.header = 'declarations_calldef.hpp' - self.declarations = None + self.global_ns = None def setUp(self): - if not self.declarations: - self.declarations = parser.parse( [self.header], self.config ) + if not tester_t.global_ns: + decls = parser.parse( [self.header], self.config ) + tester_t.global_ns = declarations.get_global_namespace( decls ) + tester_t.global_ns.init_optimizer() + self.global_ns = tester_t.global_ns + def test_regex( self ): criteria = declarations.regex_matcher_t( 'oper.*' , lambda decl: decl.name ) - operators = declarations.matcher.find( criteria, self.declarations ) + operators = declarations.matcher.find( criteria, self.global_ns ) + operators = filter( lambda d: not d.is_artificial, operators ) self.failUnless( 6 == len(operators) ) def test_access_type( self ): criteria = declarations.access_type_matcher_t( declarations.ACCESS_TYPES.PUBLIC ) - public_members = declarations.matcher.find( criteria, self.declarations ) + public_members = declarations.matcher.find( criteria, self.global_ns ) if '0.9' in public_members[0].compiler: - #2 empty classes, this compiler doesn't generate constructor and copy constructor + public_members = filter( lambda d: not d.is_artificial, public_members ) self.failUnless( 16 == len( public_members ) ) else: self.failUnless( 20 == len( public_members ) ) @@ -42,10 +48,10 @@ criteria1 = declarations.regex_matcher_t( 'oper.*' , lambda decl: decl.name ) criteria2 = declarations.access_type_matcher_t( declarations.ACCESS_TYPES.PUBLIC ) - found = declarations.matcher.find( criteria1 | criteria2, self.declarations ) + found = declarations.matcher.find( criteria1 | criteria2, self.global_ns ) if '0.9' in found[0].compiler: - #2 empty classes, this compiler doesn't generate constructor and copy constructor + found = filter( lambda d: not d.is_artificial, found ) self.failUnless( 15 <= len( found ) <= 21) else: self.failUnless( 19 <= len( found ) <= 25) @@ -54,13 +60,15 @@ criteria1 = declarations.regex_matcher_t( 'oper.*' , lambda decl: decl.name ) criteria2 = declarations.access_type_matcher_t( declarations.ACCESS_TYPES.PUBLIC ) - found = declarations.matcher.find( criteria1 & criteria2, self.declarations ) + found = declarations.matcher.find( criteria1 & criteria2, self.global_ns ) + found = filter( lambda d: not d.is_artificial, found ) self.failUnless( len( found ) <= 6 ) def test_not_matcher( self ): criteria1 = declarations.regex_matcher_t( 'oper.*' , lambda decl: decl.name ) - found = declarations.matcher.find( ~( ~criteria1 ), self.declarations ) + found = declarations.matcher.find( ~( ~criteria1 ), self.global_ns ) + found = filter( lambda d: not d.is_artificial, found ) self.failUnless( len( found ) == 6 ) def create_suite(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |