Fix tests so they compile with -Werror and -pedantic when on a machine that's not using FCNTL
This commit is contained in:
parent
fb84dfc188
commit
61e57b32a0
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
#if FMT_USE_FCNTL
|
||||||
// This is used to suppress coverity warnings about untrusted values.
|
// This is used to suppress coverity warnings about untrusted values.
|
||||||
std::string sanitize(const std::string& s) {
|
std::string sanitize(const std::string& s) {
|
||||||
std::string result;
|
std::string result;
|
||||||
@ -29,6 +30,7 @@ std::string sanitize(const std::string& s) {
|
|||||||
result.push_back(static_cast<char>(*i & 0xff));
|
result.push_back(static_cast<char>(*i & 0xff));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// 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 {
|
||||||
|
|||||||
@ -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) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user