Skip to content

Commit

Permalink
Add new test for is_noncopyable
Browse files Browse the repository at this point in the history
... when used on classes having static const members.
  • Loading branch information
iMichka committed Feb 19, 2017
1 parent e697d33 commit d3780a9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
18 changes: 18 additions & 0 deletions unittests/data/non_copyable_classes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,24 @@ class MainFoo5 : Foo5 {
char b;
};

// ----------------------------------------------- Member with static qualifiers

// Foo6 is a base class (with a static const variable foo)
class Foo6 {
private:
Foo6();
protected:
static const int foo1;
};

// Use the base class: this class is copyable, it has a public ctor, and
// the base class does not contain non-copyable members (because of the static
// qualifier)
class MainFoo6 : Foo6 {
public:
MainFoo6();
};

}

#endif//__non_copyable_classes_hpp__
7 changes: 7 additions & 0 deletions unittests/non_copyable_classes_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from pygccxml import parser
from pygccxml import declarations
from pygccxml import utils


class Test(parser_test_case.parser_test_case_t):
Expand Down Expand Up @@ -52,6 +53,12 @@ def test(self):
main_foo_5 = self.global_ns.class_('MainFoo5')
self.assertTrue(declarations.is_noncopyable(main_foo_5))

if "CastXML" in utils.xml_generator:
# CastXML only test
# MainFoo6 is copyable
main_foo_6 = self.global_ns.class_('MainFoo6')
self.assertFalse(declarations.is_noncopyable(main_foo_6))


def create_suite():
suite = unittest.TestSuite()
Expand Down

0 comments on commit d3780a9

Please sign in to comment.