mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-26 09:28:21 +00:00
Fix tests.
This commit is contained in:
parent
ba89c6399c
commit
58b762f965
@ -44,6 +44,14 @@ std::string FormatSystemErrorMessage(int error_code, fmt::StringRef message) {
|
|||||||
EXPECT_THROW_MSG(statement, fmt::SystemError, \
|
EXPECT_THROW_MSG(statement, fmt::SystemError, \
|
||||||
FormatSystemErrorMessage(error_code, message))
|
FormatSystemErrorMessage(error_code, message))
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
# define EXPECT_SYSTEM_ERROR_OR_DEATH(statement, error_code, message) \
|
||||||
|
EXPECT_SYSTEM_ERROR(statement, error_code, message)
|
||||||
|
#else
|
||||||
|
# define EXPECT_SYSTEM_ERROR_OR_DEATH(statement, error_code, message) \
|
||||||
|
EXPECT_DEATH(statement, "")
|
||||||
|
#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 {
|
||||||
protected:
|
protected:
|
||||||
@ -327,7 +335,7 @@ TEST(FileTest, Read) {
|
|||||||
TEST(FileTest, ReadError) {
|
TEST(FileTest, ReadError) {
|
||||||
File f;
|
File f;
|
||||||
char buf;
|
char buf;
|
||||||
EXPECT_SYSTEM_ERROR(f.read(&buf, 1), EBADF, "cannot read from file");
|
EXPECT_SYSTEM_ERROR_OR_DEATH(f.read(&buf, 1), EBADF, "cannot read from file");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(FileTest, Write) {
|
TEST(FileTest, Write) {
|
||||||
@ -340,7 +348,7 @@ TEST(FileTest, Write) {
|
|||||||
|
|
||||||
TEST(FileTest, WriteError) {
|
TEST(FileTest, WriteError) {
|
||||||
File f;
|
File f;
|
||||||
EXPECT_SYSTEM_ERROR(f.write(" ", 1), EBADF, "cannot write to file");
|
EXPECT_SYSTEM_ERROR_OR_DEATH(f.write(" ", 1), EBADF, "cannot write to file");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(FileTest, Dup) {
|
TEST(FileTest, Dup) {
|
||||||
|
Loading…
Reference in New Issue
Block a user