mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 10:47:35 +02:00
Fix build failure when not using fcntl with -Werror (#1990)
This commit is contained in:
@ -22,14 +22,6 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// This is used to suppress coverity warnings about untrusted values.
|
|
||||||
std::string sanitize(const std::string& s) {
|
|
||||||
std::string result;
|
|
||||||
for (std::string::const_iterator i = s.begin(), end = s.end(); i != end; ++i)
|
|
||||||
result.push_back(static_cast<char>(*i & 0xff));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests that assertion macros evaluate their arguments exactly once.
|
// Tests that assertion macros evaluate their arguments exactly once.
|
||||||
class SingleEvaluationTest : public ::testing::Test {
|
class SingleEvaluationTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
@ -388,8 +380,8 @@ TEST(OutputRedirectTest, RestoreAndRead) {
|
|||||||
std::fprintf(file.get(), "[[[");
|
std::fprintf(file.get(), "[[[");
|
||||||
OutputRedirect redir(file.get());
|
OutputRedirect redir(file.get());
|
||||||
std::fprintf(file.get(), "censored");
|
std::fprintf(file.get(), "censored");
|
||||||
EXPECT_EQ("censored", sanitize(redir.restore_and_read()));
|
EXPECT_EQ("censored", redir.restore_and_read());
|
||||||
EXPECT_EQ("", sanitize(redir.restore_and_read()));
|
EXPECT_EQ("", redir.restore_and_read());
|
||||||
std::fprintf(file.get(), "]]]");
|
std::fprintf(file.get(), "]]]");
|
||||||
file = buffered_file();
|
file = buffered_file();
|
||||||
EXPECT_READ(read_end, "[[[]]]");
|
EXPECT_READ(read_end, "[[[]]]");
|
||||||
|
@ -194,12 +194,12 @@ int(test::fileno)(FILE* stream) {
|
|||||||
# define EXPECT_EQ_POSIX(expected, actual)
|
# define EXPECT_EQ_POSIX(expected, actual)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if FMT_USE_FCNTL
|
||||||
static void write_file(fmt::cstring_view filename, fmt::string_view content) {
|
static void write_file(fmt::cstring_view filename, fmt::string_view content) {
|
||||||
fmt::buffered_file f(filename, "w");
|
fmt::buffered_file f(filename, "w");
|
||||||
f.print("{}", content);
|
f.print("{}", content);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FMT_USE_FCNTL
|
|
||||||
using fmt::file;
|
using fmt::file;
|
||||||
|
|
||||||
TEST(UtilTest, GetPageSize) {
|
TEST(UtilTest, GetPageSize) {
|
||||||
|
Reference in New Issue
Block a user