forked from cory/tildefriends
libuv 1.47.0.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4615 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
16
deps/libuv/test/test-walk-handles.c
vendored
16
deps/libuv/test/test-walk-handles.c
vendored
@ -31,7 +31,7 @@ static uv_timer_t timer;
|
||||
|
||||
|
||||
static void walk_cb(uv_handle_t* handle, void* arg) {
|
||||
ASSERT(arg == (void*)magic_cookie);
|
||||
ASSERT_PTR_EQ(arg, (void*)magic_cookie);
|
||||
|
||||
if (handle == (uv_handle_t*)&timer) {
|
||||
seen_timer_handle++;
|
||||
@ -42,7 +42,7 @@ static void walk_cb(uv_handle_t* handle, void* arg) {
|
||||
|
||||
|
||||
static void timer_cb(uv_timer_t* handle) {
|
||||
ASSERT(handle == &timer);
|
||||
ASSERT_PTR_EQ(handle, &timer);
|
||||
|
||||
uv_walk(handle->loop, walk_cb, magic_cookie);
|
||||
uv_close((uv_handle_t*)handle, NULL);
|
||||
@ -56,21 +56,21 @@ TEST_IMPL(walk_handles) {
|
||||
loop = uv_default_loop();
|
||||
|
||||
r = uv_timer_init(loop, &timer);
|
||||
ASSERT(r == 0);
|
||||
ASSERT_OK(r);
|
||||
|
||||
r = uv_timer_start(&timer, timer_cb, 1, 0);
|
||||
ASSERT(r == 0);
|
||||
ASSERT_OK(r);
|
||||
|
||||
/* Start event loop, expect to see the timer handle in walk_cb. */
|
||||
ASSERT(seen_timer_handle == 0);
|
||||
ASSERT_OK(seen_timer_handle);
|
||||
r = uv_run(loop, UV_RUN_DEFAULT);
|
||||
ASSERT(r == 0);
|
||||
ASSERT(seen_timer_handle == 1);
|
||||
ASSERT_OK(r);
|
||||
ASSERT_EQ(1, seen_timer_handle);
|
||||
|
||||
/* Loop is finished, walk_cb should not see our timer handle. */
|
||||
seen_timer_handle = 0;
|
||||
uv_walk(loop, walk_cb, magic_cookie);
|
||||
ASSERT(seen_timer_handle == 0);
|
||||
ASSERT_OK(seen_timer_handle);
|
||||
|
||||
MAKE_VALGRIND_HAPPY(loop);
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user