Fix tests so they compile with -Werror and -pedantic when on a machine that's not using FCNTL

This commit is contained in:
Ashton Fagg 2020-11-06 17:27:03 -05:00
parent fb84dfc188
commit 61e57b32a0
2 changed files with 3 additions and 1 deletions

View File

@ -22,6 +22,7 @@
namespace {
#if FMT_USE_FCNTL
// This is used to suppress coverity warnings about untrusted values.
std::string sanitize(const std::string& s) {
std::string result;
@ -29,6 +30,7 @@ std::string sanitize(const std::string& s) {
result.push_back(static_cast<char>(*i & 0xff));
return result;
}
#endif
// Tests that assertion macros evaluate their arguments exactly once.
class SingleEvaluationTest : public ::testing::Test {

View File

@ -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) {