mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-05 02:27:45 +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) {
|
||||
// TODO
|
||||
EXPECT_EXIT({
|
||||
fmt::ReportSystemError(EDOM, "test error");
|
||||
std::fprintf(stderr, "end\n");
|
||||
std::exit(0);
|
||||
}, ::testing::ExitedWithCode(0),
|
||||
str(fmt::Format("test error: {}\nend\n") << strerror(EDOM)));
|
||||
fmt::Writer out;
|
||||
fmt::internal::FormatSystemErrorMessage(out, EDOM, "test error");
|
||||
out << '\n';
|
||||
EXPECT_WRITE(stderr, fmt::ReportSystemError(EDOM, "test error"), out.str());
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -357,15 +354,11 @@ TEST(UtilTest, ThrowWinError) {
|
||||
}
|
||||
|
||||
TEST(ErrorTest, ReportWinError) {
|
||||
// TODO
|
||||
fmt::Writer message;
|
||||
fmt::internal::FormatWinErrorMessage(
|
||||
message, ERROR_FILE_EXISTS, "test error");
|
||||
EXPECT_EXIT({
|
||||
fmt::ReportWinError(ERROR_FILE_EXISTS, "test error");
|
||||
std::fprintf(stderr, "end\n");
|
||||
std::exit(0);
|
||||
}, ::testing::ExitedWithCode(0), str(message));
|
||||
fmt::Writer out;
|
||||
fmt::internal::FormatWinErrorMessage(out, ERROR_FILE_EXISTS, "test error");
|
||||
out << '\n';
|
||||
EXPECT_WRITE(stderr,
|
||||
fmt::ReportWinError(ERROR_FILE_EXISTS, "test error"), out.str());
|
||||
}
|
||||
|
||||
#endif // _WIN32
|
||||
|
Loading…
Reference in New Issue
Block a user