diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-07-27 11:55:56 +0200 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2018-07-27 11:55:56 +0200 |
commit | ae83a2e69d2ddee3b470e3505ab27f74a1b98ea3 (patch) | |
tree | 21b7ee0e5a4686f5aae65a62ad301cc38ab620f2 /tests | |
parent | 746abb72a27a1959a891723b661839b7f158fa8c (diff) | |
download | gobject-introspection-ae83a2e69d2ddee3b470e3505ab27f74a1b98ea3.tar.gz |
tests: run xmlwriter tests during make check
There was a stray test() function already there. Move it to a unittest
file and run it with the other tests.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scanner/Makefile.am | 3 | ||||
-rw-r--r-- | tests/scanner/meson.build | 1 | ||||
-rw-r--r-- | tests/scanner/test_xmlwriter.py | 29 |
3 files changed, 32 insertions, 1 deletions
diff --git a/tests/scanner/Makefile.am b/tests/scanner/Makefile.am index 5322b7b4..30651ee1 100644 --- a/tests/scanner/Makefile.am +++ b/tests/scanner/Makefile.am @@ -231,7 +231,8 @@ endif PYTESTS = \ test_shlibs.py \ test_sourcescanner.py \ - test_transformer.py + test_transformer.py \ + test_xmlwriter.py TESTS = $(CHECKGIRS) $(CHECKDOCS) $(TYPELIBS) $(PYTESTS) TESTS_ENVIRONMENT = env srcdir=$(srcdir) top_srcdir=$(top_srcdir) builddir=$(builddir) top_builddir=$(top_builddir) \ diff --git a/tests/scanner/meson.build b/tests/scanner/meson.build index 07df91a9..a2ca035e 100644 --- a/tests/scanner/meson.build +++ b/tests/scanner/meson.build @@ -11,6 +11,7 @@ if cc.get_id() != 'msvc' scanner_test_files += [ 'test_sourcescanner.py', 'test_transformer.py', + 'test_xmlwriter.py', ] endif diff --git a/tests/scanner/test_xmlwriter.py b/tests/scanner/test_xmlwriter.py new file mode 100644 index 00000000..36df7ab8 --- /dev/null +++ b/tests/scanner/test_xmlwriter.py @@ -0,0 +1,29 @@ +import unittest + +from giscanner.xmlwriter import XMLWriter + + +class TestXMLWriter(unittest.TestCase): + + def test_various(self): + w = XMLWriter() + w.push_tag('repository') + w.push_tag('namespace') + w.push_tag('enumeration') + w.push_tag('member', + [('name', 'west'), + ('value', '7'), + ('c:identifier', 'GTK_ANCHOR_WEST'), + ('glib:nick', 'west')]) + + w.pop_tag() + w.pop_tag() + w.pop_tag() + x = w.get_xml() + self.assertTrue('GTK_ANCHOR_WEST' in x) + lines = x.split('\n') + self.assertTrue(len(lines[3]) < 80) + + +if __name__ == '__main__': + unittest.main() |