]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add GMutex and GRecMutex test to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 23 Jul 2019 07:00:44 +0000 (09:00 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 6 Aug 2019 11:52:00 +0000 (13:52 +0200)
tests/Makefile.am
tests/structs/gmutex.vala [new file with mode: 0644]

index 1c5789bad88b1ac45b0d9b511d6adc1b1b4e10ef..7df354c66f78c03da92f704c9eefc014d0431b7f 100644 (file)
@@ -164,6 +164,7 @@ TESTS = \
        enums/bug780050.vala \
        structs/struct_only.vala \
        structs/structs.vala \
+       structs/gmutex.vala \
        structs/gvalue.vala \
        structs/gvalue-implicit-comparison.vala \
        structs/bug530605.vala \
diff --git a/tests/structs/gmutex.vala b/tests/structs/gmutex.vala
new file mode 100644 (file)
index 0000000..afbbc10
--- /dev/null
@@ -0,0 +1,15 @@
+void main () {
+       {
+               Mutex mutex = Mutex ();
+               mutex.lock ();
+               assert (!mutex.trylock ());
+               mutex.unlock ();
+       }
+       {
+               RecMutex mutex = RecMutex ();
+               mutex.lock ();
+               assert (mutex.trylock ());
+               mutex.unlock ();
+               mutex.unlock ();
+       }
+}