[gobject-introspection] tests: Add transformer tests for callback typedefs
- From: Simon Feltman <sfeltman src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] tests: Add transformer tests for callback typedefs
- Date: Thu, 2 Jan 2014 22:48:46 +0000 (UTC)
commit 802a048819b9d0acb9c004eeba05d74e46170d3d
Author: Simon Feltman <sfeltman src gnome org>
Date: Sat Dec 28 03:15:49 2013 -0800
tests: Add transformer tests for callback typedefs
Add a basic transformer unittest for callback typedefs.
https://bugzilla.gnome.org/show_bug.cgi?id=581525
tests/scanner/test_transformer.py | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/tests/scanner/test_transformer.py b/tests/scanner/test_transformer.py
index 5a0e82c..abfce18 100644
--- a/tests/scanner/test_transformer.py
+++ b/tests/scanner/test_transformer.py
@@ -428,5 +428,21 @@ class TestUnions(unittest.TestCase):
self.assertEqual(nested.fields[1].type.ctype, 'float')
+class TestCallbacks(unittest.TestCase):
+ def setUp(self):
+ # Hack to set logging singleton
+ self.namespace = ast.Namespace('Test', '1.0')
+ logger = MessageLogger.get(namespace=self.namespace)
+ logger.enable_warnings((WARNING, ERROR, FATAL))
+
+ def test_union_with_struct(self):
+ load_namespace_from_source_string(self.namespace, """
+ typedef void (*TestCallback)(int value);
+ """)
+ self.assertEqual(len(self.namespace.names), 1)
+ node = self.namespace.get('Callback')
+ self.assertTrue(isinstance(node, ast.Callback))
+
+
if __name__ == '__main__':
unittest.main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]