From 9fbd6798f45f93879e5b08fe885219e6340c7892 Mon Sep 17 00:00:00 2001 From: Niels De Graef Date: Fri, 27 Jul 2018 01:36:33 +0200 Subject: Allow adding tests. * Have a very basic test that calls something from Contacts.Utils, so we know that it was able to properly compile and link. * Some function access modifiers had to be changed to public, or they wouldn't be recoginzed outside of the static library. * Also make sure our CI actually runs the tests. --- tests/basic-test.vala | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/basic-test.vala (limited to 'tests/basic-test.vala') diff --git a/tests/basic-test.vala b/tests/basic-test.vala new file mode 100644 index 0000000..9cf1517 --- /dev/null +++ b/tests/basic-test.vala @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2018 Niels De Graef + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program. If not, see . + */ + +using Gee; + +void main (string[] args) { + Test.init (ref args); + Test.add_func ("/utils/get_first", Contacts.UtilsTests.get_first); + Test.run (); +} + +namespace Contacts.UtilsTests { + private void get_first () { + Collection empty = Collection.empty (); + assert_true (Utils.get_first (empty) == null); + } +} -- cgit v1.2.1