aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-12-29 18:26:44 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:12:52 -0300
commit882c98f7a9b3a3fc030cee87235cf8b375cd6b54 (patch)
treebe9d5723a0f914bf96ac955c5d0a0356dbf1d051 /tests
parent2faf996129baf265c4b9ed1ff72a4cfb378d8306 (diff)
Add support for operator overload injection.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Lauro Moura <lauro.neto@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/samplebinding/objecttypeoperators_test.py3
-rw-r--r--tests/samplebinding/typesystem_sample.xml8
2 files changed, 10 insertions, 1 deletions
diff --git a/tests/samplebinding/objecttypeoperators_test.py b/tests/samplebinding/objecttypeoperators_test.py
index 148bc3591..71e5a5d40 100644
--- a/tests/samplebinding/objecttypeoperators_test.py
+++ b/tests/samplebinding/objecttypeoperators_test.py
@@ -47,6 +47,9 @@ class ObjectTypeOperatorsTest(unittest.TestCase):
self.assertEqual("a", a)
self.assertEqual(a, "a")
+ def testOperatorInjection(self):
+ a = ObjectTypeOperators("a")
+ self.assertNotEqual(a, "b")
if __name__ == '__main__':
unittest.main()
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml
index 576c54656..5a518c34a 100644
--- a/tests/samplebinding/typesystem_sample.xml
+++ b/tests/samplebinding/typesystem_sample.xml
@@ -1274,7 +1274,13 @@
<object-type name="HandleHolder" />
- <object-type name="ObjectTypeOperators" />
+ <object-type name="ObjectTypeOperators">
+ <add-function signature="operator!=(std::string)" return-type="bool">
+ <inject-code class="target">
+ %PYARG_0 = %CONVERTTOPYTHON[bool](%CPPSELF.key() != %1);
+ </inject-code>
+ </add-function>
+ </object-type>
<!-- type used in abstract method -->
<object-type name="HideType" generate="no" />