[gxml] Unit Tests ported to Meson



commit 651ce4782eed4745c04a09a71999f0f23d99b8b9
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed May 10 11:51:26 2017 -0500

    Unit Tests ported to Meson

 gxml/meson.build |   20 ++++++++++--------
 meson.build      |    5 +---
 test/meson.build |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 vapi/meson.build |    1 +
 4 files changed, 71 insertions(+), 13 deletions(-)
---
diff --git a/gxml/meson.build b/gxml/meson.build
index 315600b..3f1618e 100644
--- a/gxml/meson.build
+++ b/gxml/meson.build
@@ -23,10 +23,15 @@ configure_file(input : 'gxml.deps.in',
 
 conf = configuration_data()
 conf.set_quoted('PACKAGE_LOCALE_DIR', join_paths(get_option('prefix'), get_option('datadir'), 'locale'))
-conf.set_quoted('GETTEXT_PACKAGE', 'GXml')
+conf.set_quoted('GETTEXT_PACKAGE', 'gxml')
 configure_file(output : 'config.h',
        configuration : conf)
 
+nsinfo = configure_file(input : 'namespace-info.vala.in',
+       output : 'namespace-info.vala',
+       configuration : conf)
+namespaceinfo_dep = declare_dependency (sources : nsinfo)
+
 valasources = files ([
        'Attribute.vala',
        'CDATA.vala',
@@ -108,8 +113,7 @@ valasources = files ([
        'TProcessingInstruction.vala',
        'TText.vala',
        'XParser.vala',
-       'XPath.vala',
-       meson.build_root() + '/namespace-info.vala'
+       'XPath.vala'
 ])
 
 sources = files ([
@@ -117,17 +121,15 @@ sources = files ([
        'xlibxml.h'
 ])
 
+inc_gxmlh = include_directories ('.')
+
 gxml = library('gxml-@0@'.format(API_VERSION),
-       valasources+sources,
+       valasources+sources+configvapi,
        version : GXML_VERSION,
        vala_header : 'gxml.h',
        vala_vapi : 'gxml-@0@.vapi'.format(API_VERSION),
        vala_gir : 'GXml-@0@.gir'.format(API_VERSION),
-       dependencies : [ gee, gio, xml ],
-       vala_args : [
-               '--vapidir=' + meson.source_root() + '/vapi',
-               '--pkg', 'config'
-       ],
+       dependencies : [ gee, gio, xml, namespaceinfo_dep ],
        c_args : [
                '-include',
                meson.current_build_dir() + '/config.h',
diff --git a/meson.build b/meson.build
index 0083afb..5c2f493 100644
--- a/meson.build
+++ b/meson.build
@@ -15,11 +15,8 @@ xlibxml_cflags = '-I' + meson.current_source_dir()
 conf = configuration_data()
 conf.set('API_VERSION', API_VERSION)
 
-configure_file(input : 'gxml/namespace-info.vala.in',
-       output : 'namespace-info.vala',
-       configuration : conf)
-
 subdir('po')
 subdir('vapi')
 subdir('gxml')
 subdir('docs')
+subdir('test')
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 0000000..87d0fe8
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,58 @@
+glib_dep = dependency('glib-2.0')
+gobject_dep = dependency('gobject-2.0')
+gio_dep = dependency('gio-2.0')
+gee_dep = dependency('gee-0.8')
+lxml_dep = dependency('libxml-2.0')
+gxmlh_dep = declare_dependency (include_directories : inc_gxmlh)
+testdirs_dep = declare_dependency (compile_args : [
+       '-DTEST_DIR="'+join_paths (meson.source_root (),'test')+'"',
+       '-DTEST_SAVE_DIR="'+join_paths (meson.build_root (),'test')+'"',
+])
+envtestdir = environment ()
+envtestdir.set ('TEST_DIR',meson.source_root ())
+envtestdir.set ('TEST_SAVE_DIR',meson.build_root ())
+
+t = executable('gxml_test', [
+       'GXmlTest.vala',
+       'NodeListTest.vala',
+       'ValaLibxml2Test.vala',
+       'EnumerationTest.vala',
+       'SerializableTest.vala',
+       'SerializablePropertyBoolTest.vala',
+       'SerializablePropertyDoubleTest.vala',
+       'SerializablePropertyFloatTest.vala',
+       'SerializablePropertyEnumTest.vala',
+       'SerializablePropertyIntTest.vala',
+       'SerializablePropertyValueListTest.vala',
+       'SerializableObjectModelTest.vala',
+       'SerializableObjectModel-TDocument-Test.vala',
+       'SerializableGeeTreeMapTest.vala',
+       'SerializableGeeDualKeyMapTest.vala',
+       'SerializableGeeArrayListTest.vala',
+       'SerializableGeeHashMapTest.vala',
+       'SerializableGeeCollectionsTest.vala',
+       'SerializableGeeCollections-TDocument-Test.vala',
+       'SerializableBasicTypesTest.vala',
+       'gxml-performance.vala',
+       'TElementTest.vala',
+       'TDocumentTest.vala',
+       'TCDATATest.vala',
+       'TCommentTest.vala',
+       'TProcessingInstructionTest.vala',
+       'GDocumentTest.vala',
+       'GElementTest.vala',
+       'GAttributeTest.vala',
+       'HtmlDocumentTest.vala',
+       'DomGDocumentTest.vala',
+       'XPathTest.vala',
+       'GomDocumentTest.vala',
+       'GomElementTest.vala',
+       'GomSerializationTest.vala',
+       'GomSchemaTest.vala'
+] + configvapi + configtestvapi,
+vala_args : [],
+dependencies : [glib_dep, gobject_dep, gio_dep, gee_dep, lxml_dep, gxmlh_dep, testdirs_dep],
+link_with: gxml
+)
+
+test ('gxml', t)
diff --git a/vapi/meson.build b/vapi/meson.build
index 8352ebf..e8a9d95 100644
--- a/vapi/meson.build
+++ b/vapi/meson.build
@@ -1,2 +1,3 @@
 configvapi = files ('config.vapi')
+configtestvapi = files('gxml-test.vapi')
 xlibxmlvapi = files ('xlibxml-1.0.vapi')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]