Skip to content

Remove lambda wrapper #61

@sgerbino

Description

@sgerbino

This snippet demonstrates a workaround in when_all() unit tests that needs to be removed. The workaround is required because of issue #60.

capy/test/unit/when_all.cpp

Lines 265 to 280 in bc33a78

async_run(d)(
[]() -> task<std::tuple<int, int, int>> {
co_return co_await when_all(
throws_exception("error_1"),
throws_exception("error_2"),
throws_exception("error_3"));
}(),
[](std::tuple<int, int, int>) {},
[&](std::exception_ptr ep) {
try {
std::rethrow_exception(ep);
} catch (test_exception const& e) {
caught_exception = true;
error_msg = e.what();
}
});

After there is a resolution for #60, we should remove the lambda wrappers for the desired API:

 async_run(d)( 
     when_all(throws_exception("error_1"), throws_exception("error_2"), throws_exception("error_3")), 
     [](std::tuple<int, int, int>) {}, 
     [&](std::exception_ptr ep) { 
         try { 
             std::rethrow_exception(ep); 
         } catch (test_exception const& e) { 
             caught_exception = true; 
             error_msg = e.what(); 
         } 
     }); 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions