Skip to content

Commit e0ec5bb

Browse files
committed
chore: improve build cleanliness
1 parent b8607e4 commit e0ec5bb

9 files changed

Lines changed: 14 additions & 79 deletions

tests/app/app_constructor_test.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,9 @@ namespace
100100

101101
assert(app.router() != nullptr);
102102

103-
/*
104-
* These accessors return references. Taking their address verifies that
105-
* the objects are present and usable without starting the server.
106-
*/
107-
assert(&app.config() != nullptr);
108-
assert(&app.server() != nullptr);
109-
assert(&app.executor() != nullptr);
103+
(void)app.config();
104+
(void)app.server();
105+
(void)app.executor();
110106

111107
app.close();
112108
}

tests/app/app_lifecycle_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ namespace
10831083

10841084
close_and_wait(app);
10851085

1086-
assert(&app.executor() != nullptr);
1086+
(void)app.executor();
10871087
}
10881088

10891089
static void test_listen_after_manual_close_keeps_app_stopped()

tests/app/app_middleware_test.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -89,26 +89,7 @@ namespace
8989
};
9090
}
9191

92-
static bool has_record(
93-
const std::vector<RouteRecord> &records,
94-
const std::string &method,
95-
const std::string &path,
96-
bool heavy = false)
97-
{
98-
for (const auto &record : records)
99-
{
100-
if (record.method == method &&
101-
record.path == path &&
102-
record.heavy == heavy)
103-
{
104-
return true;
105-
}
106-
}
107-
108-
return false;
109-
}
110-
111-
static std::size_t count_records(
92+
static std::size_t count_records(
11293
const std::vector<RouteRecord> &records,
11394
const std::string &method,
11495
const std::string &path)

tests/app/app_static_dir_test.cpp

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -127,23 +127,11 @@ namespace
127127
static App &register_static_dir(
128128
App &app,
129129
const std::filesystem::path &root,
130-
const std::string &mount = "/")
131-
{
132-
std::filesystem::path mutable_root = root;
133-
134-
app.static_dir(mutable_root, mount);
135-
136-
return app;
137-
}
138-
139-
static App &register_static_dir(
140-
App &app,
141-
const std::filesystem::path &root,
142-
const std::string &mount,
143-
const std::string &index_file,
144-
bool add_cache_control,
145-
const std::string &cache_control,
146-
bool fallthrough)
130+
const std::string &mount = "/",
131+
const std::string &index_file = "index.html",
132+
bool add_cache_control = false,
133+
const std::string &cache_control = "",
134+
bool fallthrough = false)
147135
{
148136
std::filesystem::path mutable_root = root;
149137

tests/app/app_static_hook_test.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,7 @@ namespace
127127
assert(app.router()->has_route(method, path) == true);
128128
}
129129

130-
static void assert_route_not_registered(
131-
App &app,
132-
const std::string &method,
133-
const std::string &path)
134-
{
135-
assert(app.router() != nullptr);
136-
assert(app.router()->has_route(method, path) == false);
137-
}
138-
139-
struct StaticHandlerCall
130+
struct StaticHandlerCall
140131
{
141132
bool called{false};
142133
App *app{nullptr};

tests/config/config_copy_move_test.cpp

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,7 @@ namespace
108108
return dir / ".env";
109109
}
110110

111-
static std::filesystem::path make_env_file(const std::string &content)
112-
{
113-
const std::filesystem::path path = make_empty_env_path();
114-
115-
std::ofstream out(path, std::ios::binary | std::ios::trunc);
116-
assert(out);
117-
118-
out << content;
119-
out.close();
120-
121-
assert(std::filesystem::exists(path));
122-
123-
return path;
124-
}
125-
126-
static Config make_config_from_current_env()
111+
static Config make_config_from_current_env()
127112
{
128113
const std::filesystem::path env_path = make_empty_env_path();
129114

tests/router/router_dispatch_test.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,7 @@ namespace
192192
return result;
193193
}
194194

195-
static bool contains(const std::string &text, const std::string &needle)
196-
{
197-
return text.find(needle) != std::string::npos;
198-
}
199-
200-
static vix::json::Json parse_body(const Response &res)
195+
static vix::json::Json parse_body(const Response &res)
201196
{
202197
return vix::json::loads(res.body());
203198
}

tests/runtime/bench_threadpool_vs_runtime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace
5656
const auto end = Clock::now();
5757

5858
const double elapsedMs =
59-
std::chrono::duration_cast<Ns>(end - start).count() / 1'000'000.0;
59+
static_cast<double>(std::chrono::duration_cast<Ns>(end - start).count()) / 1'000'000.0;
6060

6161
const double opsPerSec =
6262
(elapsedMs <= 0.0) ? 0.0 : (static_cast<double>(operations) * 1000.0 / elapsedMs);

tests/session/session_error_test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ namespace
144144
Response &) override
145145
{
146146
throw std::runtime_error("handler failed");
147-
co_return;
148147
}
149148
};
150149

0 commit comments

Comments
 (0)