Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Apr 3, 2024
1 parent 0f8d2d5 commit 691eca9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/testleakautovar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2480,6 +2480,14 @@ class TestLeakAutoVar : public TestFixture {
" std::shared_ptr<C> a{c, [](C* x) { delete x; }};\n"
"}", true);
ASSERT_EQUALS("", errout_str());

check("struct DirDeleter {\n" // #12544
" void operator()(DIR* d) { ::closedir(d); }\n"
"};\n"
"void openDir(DIR* dir) {\n"
" std::shared_ptr<DIR> dp(dir, DirDeleter());\n"
"}\n", true);
ASSERT_EQUALS("[test.cpp:2]: (information) --check-library: Function closedir() should have <noreturn> configuration\n", errout_str()); // don't crash
}
void smartPointerRelease() {
check("void f() {\n"
Expand Down

0 comments on commit 691eca9

Please sign in to comment.