Skip to content

Commit 9a0b3a6

Browse files
author
roman_yakovenko
committed
few bug fixes, after upgrading to latest gccxml version
1 parent 687e247 commit 9a0b3a6

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

unittests/project_reader_correctness_tester.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
# Distributed under the Boost Software License, Version 1.0. (See
33
# accompanying file LICENSE_1_0.txt or copy at
44
# http://www.boost.org/LICENSE_1_0.txt)
5-
5+
import os
66
import unittest
77
import autoconfig
88
import parser_test_case
99

1010
import pygccxml
11-
from pygccxml.utils import *
12-
from pygccxml.parser import *
13-
from pygccxml.declarations import *
11+
from pygccxml import utils
12+
from pygccxml import parser
13+
from pygccxml import declarations
1414

1515
class tester_t( parser_test_case.parser_test_case_t ):
1616
def __init__(self, *args):
1717
parser_test_case.parser_test_case_t.__init__(self, *args)
1818
self.__files = [
19-
'core_ns_join_1.hpp'
19+
'core_types.hpp'
20+
, 'core_ns_join_1.hpp'
2021
, 'core_ns_join_2.hpp'
2122
, 'core_ns_join_3.hpp'
2223
, 'core_membership.hpp'
2324
, 'core_class_hierarchy.hpp'
24-
, 'core_types.hpp'
2525
, 'core_diamand_hierarchy_base.hpp'
2626
, 'core_diamand_hierarchy_derived1.hpp'
2727
, 'core_diamand_hierarchy_derived2.hpp'
@@ -31,13 +31,21 @@ def __init__(self, *args):
3131
]
3232

3333
def __test_correctness_impl(self, file_name ):
34-
prj_reader = project_reader_t( self.config )
34+
prj_reader = parser.project_reader_t( self.config )
3535
prj_decls = prj_reader.read_files( [file_name]*2
36-
, compilation_mode=COMPILATION_MODE.FILE_BY_FILE )
37-
src_reader = source_reader_t( self.config )
36+
, compilation_mode=parser.COMPILATION_MODE.FILE_BY_FILE )
37+
src_reader = parser.source_reader_t( self.config )
3838
src_decls = src_reader.read_file( file_name )
39-
self.failUnless( src_decls == prj_decls
40-
, "There is a difference between declarations in file %s." % file_name )
39+
if src_decls != prj_decls:
40+
s = src_decls[0]
41+
p = prj_decls[0]
42+
sr = file( os.path.join( autoconfig.build_directory , file_name + '.sr.txt'),'w+' )
43+
pr = file( os.path.join( autoconfig.build_directory , file_name + '.pr.txt'), 'w+' )
44+
declarations.print_declarations( s, writer=lambda l: sr.write( l + os.linesep ) )
45+
declarations.print_declarations( p, writer=lambda l: pr.write( l + os.linesep ) )
46+
sr.close()
47+
pr.close()
48+
self.fail( "There is a difference between declarations in file %s." % file_name )
4149

4250
def test_correctness(self):
4351
for src in self.__files:

0 commit comments

Comments
 (0)