diff options
author | Niels De Graef <nielsdegraef@gmail.com> | 2018-07-27 01:36:33 +0200 |
---|---|---|
committer | Niels De Graef <nielsdegraef@gmail.com> | 2018-07-27 01:56:55 +0200 |
commit | 9fbd6798f45f93879e5b08fe885219e6340c7892 (patch) | |
tree | ac5ec0fa740db2ef13a277e96b72d480395a6871 /tests | |
parent | df90f1d4ddcdc6b48dea4f5bacbc07b7d6896b75 (diff) | |
download | gnome-contacts-9fbd6798f45f93879e5b08fe885219e6340c7892.tar.gz |
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basic-test.vala | 31 | ||||
-rw-r--r-- | tests/meson.build | 12 |
2 files changed, 43 insertions, 0 deletions
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 <nielsdegraef@gmail.com> + * + * 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 <http://www.gnu.org/licenses/>. + */ + +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<Object> empty = Collection.empty (); + assert_true (Utils.get_first (empty) == null); + } +} diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 0000000..ddf0cb5 --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,12 @@ +test_names = [ + 'basic-test', +] + +foreach _test : test_names + test_bin = executable(_test, + '@0@.vala'.format(_test), + dependencies: libcontacts_dep, + ) + + test(_test, test_bin) +endforeach |