tests: avoid multiple g_log_set_writer_func calls
Apparently calling g_log_set_writer_func
was never meant to be called more than once, even though it worked just fine. Work around this by introducing another level of indirection: A new TestContext
struct is passed to all tests as user_data
and in this we save keep track of the current logger. It is reset to the standard logger for the tests in the test's setup function.
NB: since the test data is passed via gconstpointer
we need to explicitly cast the const away. This is ok since the actual TestContext
object is non-const.
Closes #181 (closed)
Edited by Christian Kellner