tests: fix warnings exposed by -Werror and a non-recursive Storage copy
This commit is contained in:
1 parent
2c8d853af0
commit
92d60231e5
5 files changed
+10
-18
No files matched your search
@@ -44,7 +44,9 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
void write_raw_tar(const std::filesystem::path& path,
|
||||
// Used only when the upstream LibArchive backend is absent; keep it
|
||||
// compiled so the pure-C++ fallback path is covered in that build.
|
||||
[[maybe_unused]] void write_raw_tar(const std::filesystem::path& path,
|
||||
std::span<const ArchiveEntry> entries)
|
||||
{
|
||||
std::ofstream out{path, std::ios::binary | std::ios::trunc};
|
||||
|
||||
@@ -67,7 +67,7 @@ Void::Testing::Test lru_get_promotes_entry()
|
||||
c.put(1, "a");
|
||||
c.put(2, "b");
|
||||
c.put(3, "c");
|
||||
c.get(1); // promote 1 to MRU
|
||||
(void)c.get(1); // promote 1 to MRU
|
||||
c.put(4, "d"); // evicts 2 (now LRU)
|
||||
Void::Testing::expect(c.contains(1));
|
||||
Void::Testing::expect(!c.contains(2));
|
||||
@@ -106,7 +106,7 @@ Void::Testing::Test lru_peek_does_not_promote()
|
||||
c.put(1, "a");
|
||||
c.put(2, "b");
|
||||
c.put(3, "c");
|
||||
c.peek(1); // peek 1 but do NOT promote
|
||||
(void)c.peek(1); // peek 1 but do NOT promote
|
||||
c.put(4, "d"); // evicts 1 (still LRU despite peek)
|
||||
Void::Testing::expect(!c.contains(1));
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ Void::Testing::Test spsc_full_push_returns_false()
|
||||
Void::Testing::Test spsc_fifo_order()
|
||||
{
|
||||
Void::Ring::SpscRing<int, 8> ring;
|
||||
for (int i = 0; i < 5; ++i) ring.push(i);
|
||||
for (int i = 0; i < 5; ++i) (void)ring.push(i);
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
const auto v = ring.pop();
|
||||
Void::Testing::expect(v.has_value());
|
||||
@@ -61,14 +61,14 @@ Void::Testing::Test spsc_capacity_is_n_minus_one()
|
||||
Void::Testing::Test spsc_full_flag()
|
||||
{
|
||||
Void::Ring::SpscRing<int, 4> ring;
|
||||
ring.push(1); ring.push(2); ring.push(3);
|
||||
(void)ring.push(1); (void)ring.push(2); (void)ring.push(3);
|
||||
Void::Testing::expect(ring.full());
|
||||
}
|
||||
|
||||
Void::Testing::Test spsc_string_values()
|
||||
{
|
||||
Void::Ring::SpscRing<std::string, 4> ring;
|
||||
ring.push(std::string{"hello"});
|
||||
(void)ring.push(std::string{"hello"});
|
||||
const auto v = ring.pop();
|
||||
Void::Testing::expect(v.has_value());
|
||||
Void::Testing::expect_eq(*v, std::string{"hello"});
|
||||
|
||||
@@ -140,17 +140,6 @@ namespace
|
||||
return true;
|
||||
}
|
||||
|
||||
std::size_t count_occurrences(std::string_view haystack,
|
||||
std::string_view needle)
|
||||
{
|
||||
std::size_t count = 0;
|
||||
std::size_t pos = 0;
|
||||
while ((pos = haystack.find(needle, pos)) != std::string_view::npos) {
|
||||
++count;
|
||||
pos += needle.size();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Void::Testing::Test http_duplex_upload_while_reading_fixed_response()
|
||||
|
||||
@@ -441,7 +441,8 @@ Void::Testing::Test storage_wal_recovery_byte_truncation_corruption_and_rotation
|
||||
{
|
||||
TempStorageDir bad_dir;
|
||||
std::filesystem::copy(base_dir.path, bad_dir.path,
|
||||
std::filesystem::copy_options::overwrite_existing);
|
||||
std::filesystem::copy_options::recursive |
|
||||
std::filesystem::copy_options::overwrite_existing);
|
||||
(void)std::filesystem::remove(bad_dir.path / "LOCK");
|
||||
{
|
||||
auto port = make_posix_file_port();
|
||||
|
||||
Reference in new issue
Block a user