add test for when scope exit lambda is an lvalue

This commit is contained in:
Francisco Paisana 2020-08-10 16:28:05 +01:00
parent 9e2a116e11
commit 9d877e55b3
1 changed files with 8 additions and 0 deletions

View File

@ -61,6 +61,14 @@ int test_scope_exit(int* value)
}
TESTASSERT(nof_calls == 1);
// TEST: lvalue callback is safe
{
nof_calls = 0;
auto task = [&nof_calls]() { nof_calls += 2; };
auto scope_exit = srslte::make_scope_exit(task);
}
TESTASSERT(nof_calls == 2);
return SRSLTE_SUCCESS;
}