Move format_system_error to the public API (#323)

This commit is contained in:
Victor Zverovich
2016-05-11 21:36:22 -06:00
parent d67eb8af2f
commit cc9b051d12
6 changed files with 43 additions and 25 deletions
+4 -4
View File
@@ -834,10 +834,10 @@ void check_throw_error(int error_code, FormatErrorMessage format) {
TEST(UtilTest, FormatSystemError) {
fmt::MemoryWriter message;
fmt::internal::format_system_error(message, EDOM, "test");
fmt::format_system_error(message, EDOM, "test");
EXPECT_EQ(fmt::format("test: {}", get_system_error(EDOM)), message.str());
message.clear();
fmt::internal::format_system_error(
fmt::format_system_error(
message, EDOM, fmt::StringRef(0, std::numeric_limits<size_t>::max()));
EXPECT_EQ(fmt::format("error {}", EDOM), message.str());
}
@@ -846,12 +846,12 @@ TEST(UtilTest, SystemError) {
fmt::SystemError e(EDOM, "test");
EXPECT_EQ(fmt::format("test: {}", get_system_error(EDOM)), e.what());
EXPECT_EQ(EDOM, e.error_code());
check_throw_error<fmt::SystemError>(EDOM, fmt::internal::format_system_error);
check_throw_error<fmt::SystemError>(EDOM, fmt::format_system_error);
}
TEST(UtilTest, ReportSystemError) {
fmt::MemoryWriter out;
fmt::internal::format_system_error(out, EDOM, "test error");
fmt::format_system_error(out, EDOM, "test error");
out << '\n';
EXPECT_WRITE(stderr, fmt::report_system_error(EDOM, "test error"), out.str());
}