From: Rico Tzschichholz Date: Tue, 23 Jul 2019 07:00:44 +0000 (+0200) Subject: tests: Add GMutex and GRecMutex test to increase coverage X-Git-Tag: 0.36.20~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d19774efb78f932bdb408964ab1359203acf225e;p=thirdparty%2Fvala.git tests: Add GMutex and GRecMutex test to increase coverage --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 1c5789bad..7df354c66 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 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 (); + } +}