[gnome-maps/wip/mlundblad/unit-tests: 2/4] Add test infrastructure for GJS-based tests



commit 24165ed7b097e7c100669988dd1439f72166403d
Author: Marcus Lundblad <ml update uu se>
Date:   Tue Apr 28 23:38:52 2020 +0200

    Add test infrastructure for GJS-based tests

 meson.build       |  1 +
 tests/meson.build | 26 ++++++++++++++++++++++++++
 tests/test.in     |  6 ++++++
 3 files changed, 33 insertions(+)
---
diff --git a/meson.build b/meson.build
index ebce469f..f0b78772 100644
--- a/meson.build
+++ b/meson.build
@@ -51,6 +51,7 @@ subdir('po')
 subdir('src')
 subdir('lib')
 subdir('data')
+subdir('tests')
 
 meson.add_install_script(
   'meson_post_install.py',
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 00000000..ff4432d2
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,26 @@
+script_conf = configuration_data()
+script_conf.set('GJS', find_program('gjs').path())
+script_conf.set('PACKAGE_VERSION', version)
+script_conf.set('libdir', libdir)
+script_conf.set('prefix', prefix)
+
+tests = []
+
+foreach test : tests
+  script_conf.set('name', test)
+  configure_file(
+    input: 'test.in',
+    output: test,
+    configuration: script_conf,
+    install: false,
+    install_dir: pkgdatadir
+  )
+endforeach
+
+foreach test : tests
+  test(test, find_program('gjs'),
+       args: ['-I', '../src/', '-I', '../tests/', 'tests/@0@'.format(test)],
+       env:  ['LANG=C', 'LC_ALL=C']
+  )
+endforeach
+
diff --git a/tests/test.in b/tests/test.in
new file mode 100644
index 00000000..1f3aeabe
--- /dev/null
+++ b/tests/test.in
@@ -0,0 +1,6 @@
+#!@GJS@
+imports.package.init({ name: "@name@",
+                       version: "@PACKAGE_VERSION@",
+                       prefix: "@prefix@",
+                       libdir: "@libdir@" });
+imports.package.run(imports.@name@);


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