]> 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, 23 Jul 2019 07:34:20 +0000 (09:34 +0200)
tests/Makefile.am
tests/structs/gmutex.vala [new file with mode: 0644]

index da383549bae00c8fbaf77ee719e4e26462ab6c3e..f1b9be8fe945161c2a7fa89d69698e47a8faa519 100644 (file)
@@ -225,6 +225,7 @@ TESTS = \
        structs/struct-static-property-initializer.test \
        structs/structs.vala \
        structs/default-gtype.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 ();
+       }
+}