mirror of
https://github.com/fmtlib/fmt.git
synced 2025-02-05 09:40:40 +00:00
Fix ReportSystemError and ReportWinError tests.
This commit is contained in:
parent
bb93cf12a7
commit
a59dc93764
@ -320,13 +320,10 @@ TEST(UtilTest, ThrowSystemError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(ErrorTest, ReportSystemError) {
|
TEST(ErrorTest, ReportSystemError) {
|
||||||
// TODO
|
fmt::Writer out;
|
||||||
EXPECT_EXIT({
|
fmt::internal::FormatSystemErrorMessage(out, EDOM, "test error");
|
||||||
fmt::ReportSystemError(EDOM, "test error");
|
out << '\n';
|
||||||
std::fprintf(stderr, "end\n");
|
EXPECT_WRITE(stderr, fmt::ReportSystemError(EDOM, "test error"), out.str());
|
||||||
std::exit(0);
|
|
||||||
}, ::testing::ExitedWithCode(0),
|
|
||||||
str(fmt::Format("test error: {}\nend\n") << strerror(EDOM)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -357,15 +354,11 @@ TEST(UtilTest, ThrowWinError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(ErrorTest, ReportWinError) {
|
TEST(ErrorTest, ReportWinError) {
|
||||||
// TODO
|
fmt::Writer out;
|
||||||
fmt::Writer message;
|
fmt::internal::FormatWinErrorMessage(out, ERROR_FILE_EXISTS, "test error");
|
||||||
fmt::internal::FormatWinErrorMessage(
|
out << '\n';
|
||||||
message, ERROR_FILE_EXISTS, "test error");
|
EXPECT_WRITE(stderr,
|
||||||
EXPECT_EXIT({
|
fmt::ReportWinError(ERROR_FILE_EXISTS, "test error"), out.str());
|
||||||
fmt::ReportWinError(ERROR_FILE_EXISTS, "test error");
|
|
||||||
std::fprintf(stderr, "end\n");
|
|
||||||
std::exit(0);
|
|
||||||
}, ::testing::ExitedWithCode(0), str(message));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
Loading…
x
Reference in New Issue
Block a user