Skip to content

Commit

Permalink
Fix build failure when not using fcntl with -Werror (#1990)
Browse files Browse the repository at this point in the history
  • Loading branch information
fagg authored Nov 6, 2020
1 parent a30b279 commit 506ff32
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
12 changes: 2 additions & 10 deletions test/gtest-extra-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@

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.
class SingleEvaluationTest : public ::testing::Test {
protected:
Expand Down Expand Up @@ -388,8 +380,8 @@ TEST(OutputRedirectTest, RestoreAndRead) {
std::fprintf(file.get(), "[[[");
OutputRedirect redir(file.get());
std::fprintf(file.get(), "censored");
EXPECT_EQ("censored", sanitize(redir.restore_and_read()));
EXPECT_EQ("", sanitize(redir.restore_and_read()));
EXPECT_EQ("censored", redir.restore_and_read());
EXPECT_EQ("", redir.restore_and_read());
std::fprintf(file.get(), "]]]");
file = buffered_file();
EXPECT_READ(read_end, "[[[]]]");
Expand Down
2 changes: 1 addition & 1 deletion test/posix-mock-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ int(test::fileno)(FILE* stream) {
# define EXPECT_EQ_POSIX(expected, actual)
#endif

#if FMT_USE_FCNTL
static void write_file(fmt::cstring_view filename, fmt::string_view content) {
fmt::buffered_file f(filename, "w");
f.print("{}", content);
}

#if FMT_USE_FCNTL
using fmt::file;

TEST(UtilTest, GetPageSize) {
Expand Down

0 comments on commit 506ff32

Please sign in to comment.