2
2
# Distributed under the Boost Software License, Version 1.0. (See
3
3
# accompanying file LICENSE_1_0.txt or copy at
4
4
# http://www.boost.org/LICENSE_1_0.txt)
5
-
5
+ import os
6
6
import unittest
7
7
import autoconfig
8
8
import parser_test_case
9
9
10
10
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
14
14
15
15
class tester_t ( parser_test_case .parser_test_case_t ):
16
16
def __init__ (self , * args ):
17
17
parser_test_case .parser_test_case_t .__init__ (self , * args )
18
18
self .__files = [
19
- 'core_ns_join_1.hpp'
19
+ 'core_types.hpp'
20
+ , 'core_ns_join_1.hpp'
20
21
, 'core_ns_join_2.hpp'
21
22
, 'core_ns_join_3.hpp'
22
23
, 'core_membership.hpp'
23
24
, 'core_class_hierarchy.hpp'
24
- , 'core_types.hpp'
25
25
, 'core_diamand_hierarchy_base.hpp'
26
26
, 'core_diamand_hierarchy_derived1.hpp'
27
27
, 'core_diamand_hierarchy_derived2.hpp'
@@ -31,13 +31,21 @@ def __init__(self, *args):
31
31
]
32
32
33
33
def __test_correctness_impl (self , file_name ):
34
- prj_reader = project_reader_t ( self .config )
34
+ prj_reader = parser . project_reader_t ( self .config )
35
35
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 )
38
38
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 )
41
49
42
50
def test_correctness (self ):
43
51
for src in self .__files :
0 commit comments