Skip to content

Commit c0eb002

Browse files
committed
Split smart pointer traits tests by class type
1 parent 24b0442 commit c0eb002

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

unittests/test_smart_pointer.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,48 @@ def __init__(self, *args):
1717
parser_test_case.parser_test_case_t.__init__(self, *args)
1818
self.header = "test_smart_pointer.hpp"
1919
self.config.cflags = "-std=c++11"
20+
self.global_ns = None
21+
22+
def setUp(self):
23+
decls = parser.parse([self.header], self.config)
24+
self.global_ns = declarations.get_global_namespace(decls)
2025

2126
def test_smart_pointer(self):
2227
"""
23-
Test code in the smart_pointer_traits module.
28+
Test smart_pointer_traits class.
2429
2530
"""
2631

2732
if self.config.xml_generator == "gccxml":
2833
return
2934

30-
decls = parser.parse([self.header], self.config)
31-
global_ns = declarations.get_global_namespace(decls)
32-
3335
criteria = declarations.declaration_matcher(name="yes1")
34-
decls = declarations.matcher.find(criteria, global_ns)
36+
decls = declarations.matcher.find(criteria, self.global_ns)
3537
self.assertTrue(
3638
declarations.smart_pointer_traits.is_smart_pointer(
3739
decls[0].decl_type))
3840

41+
def test_auto_pointer(self):
42+
"""
43+
Test auto_ptr_traits class.
44+
45+
"""
46+
47+
if self.config.xml_generator == "gccxml":
48+
return
49+
3950
criteria = declarations.declaration_matcher(name="yes2")
40-
decls = declarations.matcher.find(criteria, global_ns)
51+
decls = declarations.matcher.find(criteria, self.global_ns)
4152
self.assertTrue(
4253
declarations.auto_ptr_traits.is_smart_pointer(decls[0].decl_type))
4354

4455
criteria = declarations.declaration_matcher(name="no1")
45-
decls = declarations.matcher.find(criteria, global_ns)
56+
decls = declarations.matcher.find(criteria, self.global_ns)
4657
self.assertFalse(
4758
declarations.auto_ptr_traits.is_smart_pointer(decls[0].decl_type))
4859

4960
criteria = declarations.declaration_matcher(name="no2")
50-
decls = declarations.matcher.find(criteria, global_ns)
61+
decls = declarations.matcher.find(criteria, self.global_ns)
5162
self.assertFalse(
5263
declarations.auto_ptr_traits.is_smart_pointer(decls[0].decl_type))
5364

0 commit comments

Comments
 (0)