mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 02:37:36 +02:00
Add tests.
This commit is contained in:
@ -319,6 +319,16 @@ TEST(UtilTest, ThrowSystemError) {
|
|||||||
fmt::internal::FormatSystemErrorMessage, fmt::ThrowSystemError);
|
fmt::internal::FormatSystemErrorMessage, fmt::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)));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
TEST(UtilTest, FormatWinErrorMessage) {
|
TEST(UtilTest, FormatWinErrorMessage) {
|
||||||
@ -346,6 +356,18 @@ TEST(UtilTest, ThrowWinError) {
|
|||||||
fmt::internal::FormatWinErrorMessage, fmt::ThrowWinError);
|
fmt::internal::FormatWinErrorMessage, fmt::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));
|
||||||
|
}
|
||||||
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
class TestString {
|
class TestString {
|
||||||
|
Reference in New Issue
Block a user