summaryrefslogtreecommitdiff
path: root/tests/scanner
diff options
context:
space:
mode:
authorSimon Feltman <sfeltman@src.gnome.org>2013-12-28 03:15:49 -0800
committerSimon Feltman <sfeltman@src.gnome.org>2014-01-02 14:43:13 -0800
commit802a048819b9d0acb9c004eeba05d74e46170d3d (patch)
tree78a5b83442883cd1903ce046f242b89bbb2c596b /tests/scanner
parent3189b3cfe90ab96e51fb9c1e498f5d2e750d0a49 (diff)
downloadgobject-introspection-802a048819b9d0acb9c004eeba05d74e46170d3d.tar.gz
tests: Add transformer tests for callback typedefs
Add a basic transformer unittest for callback typedefs. https://bugzilla.gnome.org/show_bug.cgi?id=581525
Diffstat (limited to 'tests/scanner')
-rw-r--r--tests/scanner/test_transformer.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/scanner/test_transformer.py b/tests/scanner/test_transformer.py
index 5a0e82cd..abfce187 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()