From aa49abdf239bae6065fddd0839ec67a404c9748c Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Mon, 15 Sep 2025 21:15:53 +0200 Subject: Add .clang-format Make it easier to keep a consistent style --- test/io.cc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'test/io.cc') diff --git a/test/io.cc b/test/io.cc index d6e5161..843c83e 100644 --- a/test/io.cc +++ b/test/io.cc @@ -1,12 +1,12 @@ -#include - #include "io.hh" + #include "io_test_helper.hh" #include #include #include #include +#include #include #include #include @@ -15,11 +15,14 @@ namespace { bool remove_recursive(int fd) { auto* dir = fdopendir(fd); - if (!dir) return false; + if (!dir) + return false; while (auto* ent = readdir(dir)) { if (ent->d_name[0] == '.') { - if (ent->d_name[1] == '\0') continue; - if (ent->d_name[1] == '.' && ent->d_name[2] == '\0') continue; + if (ent->d_name[1] == '\0') + continue; + if (ent->d_name[1] == '.' && ent->d_name[2] == '\0') + continue; } bool is_dir; if (ent->d_type == DT_DIR) { @@ -86,14 +89,13 @@ class IoTest : public testing::Test { rmdir(tmpdir_.c_str()); } - [[nodiscard]] int dirfd() const { - return dirfd_; - } + [[nodiscard]] int dirfd() const { return dirfd_; } void touch(const std::string& name, const std::string& value = "") { auto fd = openat(dirfd(), name.c_str(), O_CREAT | O_WRONLY | O_TRUNC, 0700); EXPECT_NE(-1, fd); - if (fd == -1) return; + if (fd == -1) + return; size_t offset = 0; while (offset < value.size()) { auto ret = write(fd, value.data() + offset, value.size() - offset); -- cgit v1.3