tests: Add basic error handling to callbacks, for reference

Many users look at both examples *and* unit tests to learn how to use a
library.  We should pride ourselves in that we have not just working but
also correct and readable tests.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2017-11-14 12:17:41 +01:00
1 parent 9df7cbfc52
commit 505a7214a8
4 files changed
+29 -6

No files matched your search

+4 -1
View File
@@ -12,8 +12,11 @@ uev_t timer3;
uev_t cron1;
uev_t cron2;
static void cb(uev_t *w, void *UNUSED(arg), int UNUSED(events))
static void cb(uev_t *w, void *UNUSED(arg), int events)
{
if (UEV_ERROR == events)
fprintf(stderr, "timer watcher failed, ignoring ...\n");
fail_unless(w == &timer1);
fail_unless(uev_timer_active(&timer2));