From 5ae02604aa85cc9fb6e83d64701df2841d902483 Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Tue, 23 Jul 2019 09:00:44 +0200 Subject: [PATCH] tests: Add GMutex and GRecMutex test to increase coverage --- tests/Makefile.am | 1 + tests/structs/gmutex.vala | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 tests/structs/gmutex.vala diff --git a/tests/Makefile.am b/tests/Makefile.am index da383549b..f1b9be8fe 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 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 (); + } +} -- 2.47.2