diff options
author | Ross Lagerwall <rosslagerwall@gmail.com> | 2012-03-12 21:32:45 +0200 |
---|---|---|
committer | Ross Lagerwall <rosslagerwall@gmail.com> | 2012-03-12 21:32:45 +0200 |
commit | fa931bb3489bce61620179f60c81e8f9a9d707ab (patch) | |
tree | 9d8d043ce849ab0d6a35575abce3c203a50df3af /test | |
parent | 817f374dc151845ad076d881aee42bbfadf8e36a (diff) | |
download | libevent-fa931bb3489bce61620179f60c81e8f9a9d707ab.tar.gz |
Add a regression test for event_self_cbarg().
Diffstat (limited to 'test')
-rw-r--r-- | test/regress.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/regress.c b/test/regress.c index 024f2be8..d0338db4 100644 --- a/test/regress.c +++ b/test/regress.c @@ -1228,6 +1228,29 @@ end: } static void +event_selfarg_cb(evutil_socket_t fd, short event, void *arg) +{ + struct event *ev = arg; + struct event_base *base = event_get_base(ev); + event_base_assert_ok_(base); + event_base_loopexit(base, NULL); +} + +static void +test_event_selfarg(void *ptr) +{ + struct basic_test_data *data = ptr; + struct event_base *base = data->base; + struct event *ev = event_new(base, -1, EV_READ, event_selfarg_cb, + event_self_cbarg()); + + event_active(ev, EV_READ, 1); + event_base_dispatch(base); + + event_free(ev); +} + +static void test_bad_assign(void *ptr) { struct event ev; @@ -2335,6 +2358,7 @@ struct testcase_t main_testcases[] = { BASIC(free_active_base, TT_FORK|TT_NEED_SOCKETPAIR), BASIC(manipulate_active_events, TT_FORK|TT_NEED_BASE), + BASIC(event_selfarg, TT_FORK|TT_NEED_BASE), BASIC(bad_assign, TT_FORK|TT_NEED_BASE|TT_NO_LOGS), BASIC(bad_reentrant, TT_FORK|TT_NEED_BASE|TT_NO_LOGS), |