mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 10:47:35 +02:00
Don't call fileno on NULL file in tests (#2196)
This commit is contained in:
@ -267,21 +267,7 @@ TEST(BufferedFileTest, CloseError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(BufferedFileTest, Fileno) {
|
TEST(BufferedFileTest, Fileno) {
|
||||||
buffered_file f;
|
auto f = open_buffered_file();
|
||||||
# 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();
|
|
||||||
EXPECT_TRUE(f.fileno() != -1);
|
EXPECT_TRUE(f.fileno() != -1);
|
||||||
file copy = file::dup(f.fileno());
|
file copy = file::dup(f.fileno());
|
||||||
EXPECT_READ(copy, FILE_CONTENT);
|
EXPECT_READ(copy, FILE_CONTENT);
|
||||||
|
Reference in New Issue
Block a user