summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeLib
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-11-20 22:56:20 (GMT)
committerBrad King <brad.king@kitware.com>2023-11-20 23:22:03 (GMT)
commitf906e2482fc2ce9dc36fe7d49f8963dea2bb6ef9 (patch)
treebdfe36ebed872b3c2d5f42494ec9066567abc0dc /Tests/CMakeLib
parent89435a5662320a7b77c359a15a3457ae666ae722 (diff)
downloadCMake-f906e2482fc2ce9dc36fe7d49f8963dea2bb6ef9.zip
CMake-f906e2482fc2ce9dc36fe7d49f8963dea2bb6ef9.tar.gz
CMake-f906e2482fc2ce9dc36fe7d49f8963dea2bb6ef9.tar.bz2
Tests: Factor out callback in uv_idle_ptr test case
Diffstat (limited to 'Tests/CMakeLib')
-rw-r--r--Tests/CMakeLib/testUVHandlePtr.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/Tests/CMakeLib/testUVHandlePtr.cxx b/Tests/CMakeLib/testUVHandlePtr.cxx
index 5aab556..f367047 100644
--- a/Tests/CMakeLib/testUVHandlePtr.cxx
+++ b/Tests/CMakeLib/testUVHandlePtr.cxx
@@ -11,13 +11,15 @@ static bool testIdle()
cm::uv_loop_ptr loop;
loop.init();
- cm::uv_idle_ptr idle;
- idle.init(*loop, &idled);
- uv_idle_start(idle, [](uv_idle_t* handle) {
+ auto cb = [](uv_idle_t* handle) {
auto idledPtr = static_cast<bool*>(handle->data);
*idledPtr = true;
uv_idle_stop(handle);
- });
+ };
+
+ cm::uv_idle_ptr idle;
+ idle.init(*loop, &idled);
+ uv_idle_start(idle, cb);
uv_run(loop, UV_RUN_DEFAULT);
if (!idled) {