Skip to content

Commit a493f6c

Browse files
committed
Take position of ctor into account for gccxml test
1 parent 262630c commit a493f6c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

unittests/test_copy_constructor.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from pygccxml import parser
99
from pygccxml import declarations
10+
from pygccxml import utils
1011

1112

1213
class tester_t(parser_test_case.parser_test_case_t):
@@ -46,10 +47,18 @@ def test(self):
4647
if isinstance(decl, declarations.calldef.constructor_t):
4748
ctors.append(decl)
4849

50+
# GCCXML and CastXML return the constructors in a different order.
51+
# I hope this index inversion will cover the two cases. If different
52+
# compilers give other orders, we will need to find a nicer solution.
53+
if "CastXML" in utils.xml_generator:
54+
positions = [0, 1]
55+
elif "GCC" in utils.xml_generator:
56+
positions = [1, 0]
57+
4958
# test2::test2() [constructor]
50-
self.assertFalse(ctors[0].is_copy_constructor)
59+
self.assertFalse(ctors[positions[0]].is_copy_constructor)
5160
# test2::test2(test2 const & arg0) [copy constructor]
52-
self.assertTrue(ctors[1].is_copy_constructor)
61+
self.assertTrue(ctors[positions[1]].is_copy_constructor)
5362

5463

5564
def create_suite():

0 commit comments

Comments
 (0)