mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-01 22:20:06 +00:00
Fix warnings.
This commit is contained in:
parent
72ad3781a4
commit
e283930566
@ -39,10 +39,11 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
// Suppresses Windows assertions on invalid file descriptors, making
|
// Suppresses Windows assertions on invalid file descriptors, making
|
||||||
// POSIX functions return proper error codes instead of crashing on Windows.
|
// POSIX functions return proper error codes instead of crashing on Windows.
|
||||||
class SuppressAssert {
|
class SuppressAssert {
|
||||||
#ifdef _WIN32
|
|
||||||
private:
|
private:
|
||||||
_invalid_parameter_handler original_handler_;
|
_invalid_parameter_handler original_handler_;
|
||||||
int original_report_mode_;
|
int original_report_mode_;
|
||||||
@ -59,10 +60,12 @@ class SuppressAssert {
|
|||||||
_set_invalid_parameter_handler(original_handler_);
|
_set_invalid_parameter_handler(original_handler_);
|
||||||
_CrtSetReportMode(_CRT_ASSERT, original_report_mode_);
|
_CrtSetReportMode(_CRT_ASSERT, original_report_mode_);
|
||||||
}
|
}
|
||||||
#endif // _WIN32
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# define SUPPRESS_ASSERT(statement) { SuppressAssert sa; statement; }
|
# define SUPPRESS_ASSERT(statement) { SuppressAssert sa; statement; }
|
||||||
|
#else
|
||||||
|
# define SUPPRESS_ASSERT(statement) statement
|
||||||
|
#endif // _WIN32
|
||||||
|
|
||||||
#define EXPECT_SYSTEM_ERROR_NOASSERT(statement, error_code, message) \
|
#define EXPECT_SYSTEM_ERROR_NOASSERT(statement, error_code, message) \
|
||||||
EXPECT_SYSTEM_ERROR(SUPPRESS_ASSERT(statement), error_code, message)
|
EXPECT_SYSTEM_ERROR(SUPPRESS_ASSERT(statement), error_code, message)
|
||||||
@ -182,7 +185,7 @@ TEST(AssertionSyntaxTest, ExceptionAssertionBehavesLikeSingleStatement) {
|
|||||||
if (::testing::internal::AlwaysTrue())
|
if (::testing::internal::AlwaysTrue())
|
||||||
EXPECT_THROW_MSG(ThrowException(), std::exception, "test");
|
EXPECT_THROW_MSG(ThrowException(), std::exception, "test");
|
||||||
else
|
else
|
||||||
; // NOLINT
|
DoNothing();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AssertionSyntaxTest, WriteAssertionBehavesLikeSingleStatement) {
|
TEST(AssertionSyntaxTest, WriteAssertionBehavesLikeSingleStatement) {
|
||||||
@ -192,7 +195,7 @@ TEST(AssertionSyntaxTest, WriteAssertionBehavesLikeSingleStatement) {
|
|||||||
if (::testing::internal::AlwaysTrue())
|
if (::testing::internal::AlwaysTrue())
|
||||||
EXPECT_WRITE(stdout, std::printf("x"), "x");
|
EXPECT_WRITE(stdout, std::printf("x"), "x");
|
||||||
else
|
else
|
||||||
; // NOLINT
|
DoNothing();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests EXPECT_THROW_MSG.
|
// Tests EXPECT_THROW_MSG.
|
||||||
|
Loading…
Reference in New Issue
Block a user