Skip to content

Commit d3780a9

Browse files
committed
Add new test for is_noncopyable
... when used on classes having static const members.
1 parent e697d33 commit d3780a9

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

unittests/data/non_copyable_classes.hpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,24 @@ class MainFoo5 : Foo5 {
106106
char b;
107107
};
108108

109+
// ----------------------------------------------- Member with static qualifiers
110+
111+
// Foo6 is a base class (with a static const variable foo)
112+
class Foo6 {
113+
private:
114+
Foo6();
115+
protected:
116+
static const int foo1;
117+
};
118+
119+
// Use the base class: this class is copyable, it has a public ctor, and
120+
// the base class does not contain non-copyable members (because of the static
121+
// qualifier)
122+
class MainFoo6 : Foo6 {
123+
public:
124+
MainFoo6();
125+
};
126+
109127
}
110128

111129
#endif//__non_copyable_classes_hpp__

unittests/non_copyable_classes_tester.py

Lines changed: 7 additions & 0 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 Test(parser_test_case.parser_test_case_t):
@@ -52,6 +53,12 @@ def test(self):
5253
main_foo_5 = self.global_ns.class_('MainFoo5')
5354
self.assertTrue(declarations.is_noncopyable(main_foo_5))
5455

56+
if "CastXML" in utils.xml_generator:
57+
# CastXML only test
58+
# MainFoo6 is copyable
59+
main_foo_6 = self.global_ns.class_('MainFoo6')
60+
self.assertFalse(declarations.is_noncopyable(main_foo_6))
61+
5562

5663
def create_suite():
5764
suite = unittest.TestSuite()

0 commit comments

Comments
 (0)