summaryrefslogtreecommitdiffstats
path: root/tests/samplebinding
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-06-02 07:57:07 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-06-02 15:41:07 -0300
commit7bc6f1512b1febc026d81917f33b1ea90d23fe24 (patch)
treec0328569c80bcd54022fbe3951802739deb580b0 /tests/samplebinding
parent47d4a1f545eb7f348e46d39230a73a1b465e57a4 (diff)
downloadshiboken-7bc6f1512b1febc026d81917f33b1ea90d23fe24.tar.gz
shiboken-7bc6f1512b1febc026d81917f33b1ea90d23fe24.tar.xz
shiboken-7bc6f1512b1febc026d81917f33b1ea90d23fe24.zip
Fixes code generation for classes with private destructors.
This fix is specific for the cases when the "protected hack" is turned off. Also added some tests.
Diffstat (limited to 'tests/samplebinding')
-rwxr-xr-xtests/samplebinding/protected_test.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/samplebinding/protected_test.py b/tests/samplebinding/protected_test.py
index efb0bedb..fa477c42 100755
--- a/tests/samplebinding/protected_test.py
+++ b/tests/samplebinding/protected_test.py
@@ -31,6 +31,7 @@ import unittest
from sample import ProtectedNonPolymorphic, ProtectedVirtualDestructor
from sample import ProtectedPolymorphic, ProtectedPolymorphicDaughter, ProtectedPolymorphicGrandDaughter
from sample import ProtectedEnumClass
+from sample import PrivateDtor
from sample import Point
class ExtendedProtectedPolymorphic(ProtectedPolymorphic):
@@ -242,6 +243,22 @@ class ProtectedEnumTest(unittest.TestCase):
self.assertEqual(obj.callPublicEnumMethod(ProtectedEnumClass.PublicItem1), ProtectedEnumClass.PublicItem0)
+class PrivateDtorProtectedMethodTest(unittest.TestCase):
+ '''Test cases for classes with private destructors and protected methods.'''
+
+ def testProtectedMethod(self):
+ '''Calls protected method of a class with a private destructor.'''
+ obj = PrivateDtor.instance()
+
+ self.assertEqual(type(obj), PrivateDtor)
+ self.assertEqual(obj.instanceCalls(), 1)
+ self.assertEqual(obj.instanceCalls(), obj.protectedInstanceCalls())
+
+ obj = PrivateDtor.instance()
+ self.assertEqual(obj.instanceCalls(), 2)
+ self.assertEqual(obj.instanceCalls(), obj.protectedInstanceCalls())
+
+
if __name__ == '__main__':
unittest.main()