[gnome-2048] Add tests infrastructure.



commit 95df33bd0252ead08d8b0fc39b16584ba9027e2d
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Feb 8 18:30:59 2019 +0100

    Add tests infrastructure.

 meson.build          |  1 +
 src/meson.build      | 13 +++++++++++++
 src/test-tw12ht.vala | 37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+)
---
diff --git a/meson.build b/meson.build
index 81b3f82..d95ebc5 100644
--- a/meson.build
+++ b/meson.build
@@ -26,6 +26,7 @@ podir = join_paths(meson.current_source_dir(), 'po')
 # Dependencies
 posix_dependency = valac.find_library('posix')
 libm_dependency = cc.find_library('m', required: false) # some platforms do not have libm separated from libc
+gio_dependency = dependency('gio-2.0', version: '>= 2.40.0')
 gtk_dependency = dependency('gtk+-3.0', version: '>= 3.12.0')
 clutter_dependency = dependency('clutter-1.0', version: '>= 1.12.0')
 clutter_gtk_dependency = dependency('clutter-gtk-1.0', version: '>= 1.6.0')
diff --git a/src/meson.build b/src/meson.build
index d378c6b..83780b1 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,3 +1,16 @@
+# Tests
+tw12ht_tests = executable(
+    'tw12ht_tests',
+    [
+        'test-tw12ht.vala'
+    ],
+    dependencies : [
+        gio_dependency
+    ]
+)
+test('tw12ht-tests', tw12ht_tests)
+
+# Application
 resources = gnome.compile_resources(
   'resources',
   'org.gnome.TwentyFortyEight.gresource.xml',
diff --git a/src/test-tw12ht.vala b/src/test-tw12ht.vala
new file mode 100644
index 0000000..d8b03c0
--- /dev/null
+++ b/src/test-tw12ht.vala
@@ -0,0 +1,37 @@
+/* Copyright (C) 2019 Arnaud Bonatti <arnaud bonatti gmail com>
+ *
+ * This file is part of GNOME 2048.
+ *
+ * GNOME 2048 is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GNOME 2048 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNOME 2048; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+private class TestTw12ht : Object
+{
+    private static int main (string [] args)
+    {
+        Test.init (ref args);
+        Test.add_func ("/Tw12ht/test tests",
+                                test_tests);
+        return Test.run ();
+    }
+
+    private static void test_tests ()
+    {
+        assert_true (1 + 1 == 2);
+    }
+
+    /*\
+    * * tests
+    \*/
+}


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