Skip to content

Commit

Permalink
Enable clang-tidy for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bugdea1er committed Sep 25, 2024
1 parent 32ec319 commit 494b3b6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Checks: >
portability-*,
readability-*,
-bugprone-easily-swappable-parameters,
-cppcoreguidelines-init-variables,
-misc-const-correctness,
-misc-include-cleaner,
-modernize-return-braced-init-list,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Run clang-tidy
run: |
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -B build
clang-tidy -p build --use-color src/*.cpp
clang-tidy -p build --use-color src/*.cpp tests/*.cpp
clang-format:
runs-on: ubuntu-24.04
Expand Down
2 changes: 1 addition & 1 deletion tests/directory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ TEST(directory, move_constructor) {
directory fst = directory();
directory snd = directory(std::move(fst));

fst.~directory();
fst.~directory(); // NOLINT(*-use-after-move)

EXPECT_FALSE(snd.path().empty());
EXPECT_TRUE(fs::exists(snd));
Expand Down
18 changes: 7 additions & 11 deletions tests/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ TEST(file, read_binary) {
file tmpfile = file();
std::ofstream stream = std::ofstream(tmpfile.path(), std::ios::binary);

stream << "Hello," << std::endl;
stream << "world!" << std::endl;
stream << "Hello,\nworld!\n" << std::flush;

EXPECT_EQ(tmpfile.read(), "Hello,\nworld!\n");
}
Expand All @@ -125,8 +124,7 @@ TEST(file, read_text) {
file tmpfile = file::text();
std::ofstream stream = std::ofstream(tmpfile.path());

stream << "Hello," << std::endl;
stream << "world!" << std::endl;
stream << "Hello,\nworld!\n" << std::flush;

EXPECT_EQ(tmpfile.read(), "Hello,\nworld!\n");
}
Expand Down Expand Up @@ -220,8 +218,7 @@ TEST(file, input_stream_binary) {
file tmpfile = file();
std::ofstream ostream = std::ofstream(tmpfile.path(), std::ios::binary);

ostream << "Hello," << std::endl;
ostream << "world!" << std::endl;
ostream << "Hello,\nworld!\n" << std::flush;

auto istream = tmpfile.input_stream();
auto content = std::string(std::istreambuf_iterator<char>(istream), {});
Expand All @@ -234,8 +231,7 @@ TEST(file, input_stream_text) {
file tmpfile = file::text();
std::ofstream ostream = std::ofstream(tmpfile.path());

ostream << "Hello," << std::endl;
ostream << "world!" << std::endl;
ostream << "Hello,\nworld!\n" << std::flush;

auto istream = tmpfile.input_stream();
auto content = std::string(std::istreambuf_iterator<char>(istream), {});
Expand All @@ -247,7 +243,7 @@ TEST(file, input_stream_text) {
TEST(file, output_stream_binary) {
file tmpfile = file();
std::ofstream ostream = tmpfile.output_stream();
ostream << "Hello" << std::endl;
ostream << "Hello\n" << std::flush;

{
auto stream = std::ifstream(tmpfile.path(), std::ios::binary);
Expand All @@ -268,7 +264,7 @@ TEST(file, output_stream_binary) {
TEST(file, output_stream_text) {
file tmpfile = file::text();
std::ofstream ostream = tmpfile.output_stream();
ostream << "Hello" << std::endl;
ostream << "Hello\n" << std::flush;

{
auto stream = std::ifstream(tmpfile.path());
Expand Down Expand Up @@ -360,7 +356,7 @@ TEST(file, move_constructor) {
file fst = file();
file snd = file(std::move(fst));

fst.~file();
fst.~file(); // NOLINT(*-use-after-move)

EXPECT_FALSE(snd.path().empty());
EXPECT_TRUE(fs::exists(snd));
Expand Down

0 comments on commit 494b3b6

Please sign in to comment.