[vala/0.40] tests: Add GMutex and GRecMutex test to increase coverage



commit a9b3e7d4a873bb8ffdfd80e2f3a51daedd9f737d
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Jul 23 09:00:44 2019 +0200

    tests: Add GMutex and GRecMutex test to increase coverage

 tests/Makefile.am         |  1 +
 tests/structs/gmutex.vala | 15 +++++++++++++++
 2 files changed, 16 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 305acd1f1..69198df77 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -203,6 +203,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
index 000000000..afbbc10ec
--- /dev/null
+++ b/tests/structs/gmutex.vala
@@ -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 ();
+       }
+}


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