Skip to content

Commit

Permalink
Don't call fileno on NULL file in tests (#2196)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Mar 30, 2021
1 parent b49af04 commit afe23e7
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions test/os-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -267,21 +267,7 @@ TEST(BufferedFileTest, CloseError) {
}

TEST(BufferedFileTest, Fileno) {
buffered_file f;
# ifndef __COVERITY__
// fileno on a null FILE pointer either crashes or returns an error.
// Disable Coverity because this is intentional.
EXPECT_DEATH_IF_SUPPORTED(
{
try {
f.fileno();
} catch (const fmt::system_error&) {
std::exit(1);
}
},
"");
# endif
f = open_buffered_file();
auto f = open_buffered_file();
EXPECT_TRUE(f.fileno() != -1);
file copy = file::dup(f.fileno());
EXPECT_READ(copy, FILE_CONTENT);
Expand Down

0 comments on commit afe23e7

Please sign in to comment.