boostorg / boostorg/beast

Tests use custom completion token instead of spawn

Open
#1,996 0 comments 0 reactions 1 assignee Claimed by @vinniefalco View on GitHub
Test
Dominant language
C++
Stars
4.8k
Forks
694
Avg merge
12h 48m
Merged PRs (30d)
1

Description

Some of the tests use stackful coroutines (`boost::asio::spawn`), which creates a risky dependence on an extra component. These tests can be replaced with the style of manually advancing the operations by calling `io_context::run_one` strategically, as is done in some of the newer tests.

To make this even easier, we can introduce a new completion token type for tests which simply advances the I/O context until a condition is met and then returns, turning asynchronous calls into blocking calls. Example:

```
error_code ec;
auto bytes_transferred =
ws.async_read_some( b, run_for(2)[ec] ); // calls run_one twice
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.