diff options
-rw-r--r-- | 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 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() |