chore: No ALL_CAPS (#1760)

Fixes #1680
This commit is contained in:
Alex Kremer
2025-01-02 11:39:31 +00:00
committed by GitHub
parent efe5d08205
commit 820b32c6d7
361 changed files with 10061 additions and 9724 deletions

View File

@@ -55,15 +55,7 @@ using namespace web::ng::impl;
using namespace web::ng;
using namespace util;
struct web_WsConnectionTests : SyncAsioContextTest {
util::TagDecoratorFactory tagDecoratorFactory_{config::ClioConfigDefinition{
{"log_tag_style", config::ConfigValue{config::ConfigType::String}.defaultValue("int")}
}};
TestHttpServer httpServer_{ctx, "localhost"};
WebSocketAsyncClient wsClient_{ctx};
Request::HttpHeaders const headers_;
Request request_{"some request", headers_};
struct WebWsConnectionTests : SyncAsioContextTest {
std::unique_ptr<PlainWsConnection>
acceptConnection(boost::asio::yield_context yield)
{
@@ -90,11 +82,20 @@ struct web_WsConnectionTests : SyncAsioContextTest {
wsConnectionPtr->setTimeout(std::chrono::milliseconds{100});
return std::unique_ptr<PlainWsConnection>{wsConnectionPtr};
}
protected:
util::TagDecoratorFactory tagDecoratorFactory_{config::ClioConfigDefinition{
{"log_tag_style", config::ConfigValue{config::ConfigType::String}.defaultValue("int")}
}};
TestHttpServer httpServer_{ctx_, "localhost"};
WebSocketAsyncClient wsClient_{ctx_};
Request::HttpHeaders const headers_;
Request request_{"some request", headers_};
};
TEST_F(web_WsConnectionTests, WasUpgraded)
TEST_F(WebWsConnectionTests, WasUpgraded)
{
boost::asio::spawn(ctx, [this](boost::asio::yield_context yield) {
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
auto maybeError = wsClient_.connect("localhost", httpServer_.port(), yield, std::chrono::milliseconds{100});
[&]() { ASSERT_FALSE(maybeError.has_value()) << maybeError.value().message(); }();
});
@@ -104,7 +105,7 @@ TEST_F(web_WsConnectionTests, WasUpgraded)
});
}
TEST_F(web_WsConnectionTests, DisconnectClientOnInactivity)
TEST_F(WebWsConnectionTests, DisconnectClientOnInactivity)
{
boost::asio::io_context clientCtx;
auto work = boost::asio::make_work_guard(clientCtx);
@@ -134,11 +135,11 @@ TEST_F(web_WsConnectionTests, DisconnectClientOnInactivity)
clientThread.join();
}
TEST_F(web_WsConnectionTests, Send)
TEST_F(WebWsConnectionTests, Send)
{
Response const response{boost::beast::http::status::ok, "some response", request_};
boost::asio::spawn(ctx, [this, &response](boost::asio::yield_context yield) {
boost::asio::spawn(ctx_, [this, &response](boost::asio::yield_context yield) {
auto maybeError = wsClient_.connect("localhost", httpServer_.port(), yield, std::chrono::milliseconds{100});
[&]() { ASSERT_FALSE(maybeError.has_value()) << maybeError.value().message(); }();
auto const expectedMessage = wsClient_.receive(yield, std::chrono::milliseconds{100});
@@ -153,15 +154,15 @@ TEST_F(web_WsConnectionTests, Send)
});
}
TEST_F(web_WsConnectionTests, MultipleSend)
TEST_F(WebWsConnectionTests, MultipleSend)
{
Response const response{boost::beast::http::status::ok, "some response", request_};
boost::asio::spawn(ctx, [this, &response](boost::asio::yield_context yield) {
boost::asio::spawn(ctx_, [this, &response](boost::asio::yield_context yield) {
auto maybeError = wsClient_.connect("localhost", httpServer_.port(), yield, std::chrono::milliseconds{100});
[&]() { ASSERT_FALSE(maybeError.has_value()) << maybeError.value().message(); }();
for ([[maybe_unused]] auto _i : std::ranges::iota_view{0, 3}) {
for ([[maybe_unused]] auto i : std::ranges::iota_view{0, 3}) {
auto const expectedMessage = wsClient_.receive(yield, std::chrono::milliseconds{100});
[&]() { ASSERT_TRUE(expectedMessage.has_value()) << expectedMessage.error().message(); }();
EXPECT_EQ(expectedMessage.value(), response.message());
@@ -171,18 +172,18 @@ TEST_F(web_WsConnectionTests, MultipleSend)
runSpawn([this, &response](boost::asio::yield_context yield) {
auto wsConnection = acceptConnection(yield);
for ([[maybe_unused]] auto _i : std::ranges::iota_view{0, 3}) {
for ([[maybe_unused]] auto unused : std::ranges::iota_view{0, 3}) {
auto maybeError = wsConnection->send(response, yield);
[&]() { ASSERT_FALSE(maybeError.has_value()) << maybeError.value().message(); }();
}
});
}
TEST_F(web_WsConnectionTests, SendFailed)
TEST_F(WebWsConnectionTests, SendFailed)
{
Response const response{boost::beast::http::status::ok, "some response", request_};
boost::asio::spawn(ctx, [this](boost::asio::yield_context yield) {
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
auto maybeError = wsClient_.connect("localhost", httpServer_.port(), yield, std::chrono::milliseconds{100});
[&]() { ASSERT_FALSE(maybeError.has_value()) << maybeError.value().message(); }();
wsClient_.close();
@@ -202,9 +203,9 @@ TEST_F(web_WsConnectionTests, SendFailed)
});
}
TEST_F(web_WsConnectionTests, Receive)
TEST_F(WebWsConnectionTests, Receive)
{
boost::asio::spawn(ctx, [this](boost::asio::yield_context yield) {
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
auto maybeError = wsClient_.connect("localhost", httpServer_.port(), yield, std::chrono::milliseconds{100});
[&]() { ASSERT_FALSE(maybeError.has_value()) << maybeError.value().message(); }();
@@ -221,13 +222,13 @@ TEST_F(web_WsConnectionTests, Receive)
});
}
TEST_F(web_WsConnectionTests, MultipleReceive)
TEST_F(WebWsConnectionTests, MultipleReceive)
{
boost::asio::spawn(ctx, [this](boost::asio::yield_context yield) {
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
auto maybeError = wsClient_.connect("localhost", httpServer_.port(), yield, std::chrono::milliseconds{100});
[&]() { ASSERT_FALSE(maybeError.has_value()) << maybeError.value().message(); }();
for ([[maybe_unused]] auto _i : std::ranges::iota_view{0, 3}) {
for ([[maybe_unused]] auto i : std::ranges::iota_view{0, 3}) {
maybeError = wsClient_.send(yield, request_.message(), std::chrono::milliseconds{100});
EXPECT_FALSE(maybeError.has_value()) << maybeError->message();
}
@@ -236,7 +237,7 @@ TEST_F(web_WsConnectionTests, MultipleReceive)
runSpawn([this](boost::asio::yield_context yield) {
auto wsConnection = acceptConnection(yield);
for ([[maybe_unused]] auto _i : std::ranges::iota_view{0, 3}) {
for ([[maybe_unused]] auto unused : std::ranges::iota_view{0, 3}) {
auto maybeRequest = wsConnection->receive(yield);
[&]() { ASSERT_TRUE(maybeRequest.has_value()) << maybeRequest.error().message(); }();
EXPECT_EQ(maybeRequest->message(), request_.message());
@@ -244,9 +245,9 @@ TEST_F(web_WsConnectionTests, MultipleReceive)
});
}
TEST_F(web_WsConnectionTests, ReceiveTimeout)
TEST_F(WebWsConnectionTests, ReceiveTimeout)
{
boost::asio::spawn(ctx, [this](boost::asio::yield_context yield) {
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
auto maybeError = wsClient_.connect("localhost", httpServer_.port(), yield, std::chrono::milliseconds{100});
[&]() { ASSERT_FALSE(maybeError.has_value()) << maybeError.value().message(); }();
});
@@ -260,9 +261,9 @@ TEST_F(web_WsConnectionTests, ReceiveTimeout)
});
}
TEST_F(web_WsConnectionTests, ReceiveFailed)
TEST_F(WebWsConnectionTests, ReceiveFailed)
{
boost::asio::spawn(ctx, [this](boost::asio::yield_context yield) {
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
auto maybeError = wsClient_.connect("localhost", httpServer_.port(), yield, std::chrono::milliseconds{100});
[&]() { ASSERT_FALSE(maybeError.has_value()) << maybeError.value().message(); }();
wsClient_.close();
@@ -276,9 +277,9 @@ TEST_F(web_WsConnectionTests, ReceiveFailed)
});
}
TEST_F(web_WsConnectionTests, Close)
TEST_F(WebWsConnectionTests, Close)
{
boost::asio::spawn(ctx, [this](boost::asio::yield_context yield) {
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
auto maybeError = wsClient_.connect("localhost", httpServer_.port(), yield, std::chrono::milliseconds{100});
[&]() { ASSERT_FALSE(maybeError.has_value()) << maybeError.value().message(); }();
auto const maybeMessage = wsClient_.receive(yield, std::chrono::milliseconds{100});
@@ -292,9 +293,9 @@ TEST_F(web_WsConnectionTests, Close)
});
}
TEST_F(web_WsConnectionTests, CloseWhenConnectionIsAlreadyClosed)
TEST_F(WebWsConnectionTests, CloseWhenConnectionIsAlreadyClosed)
{
boost::asio::spawn(ctx, [this](boost::asio::yield_context yield) {
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
auto maybeError = wsClient_.connect("localhost", httpServer_.port(), yield, std::chrono::milliseconds{100});
[&]() { ASSERT_FALSE(maybeError.has_value()) << maybeError.value().message(); }();
wsClient_.close();