diff --git a/src/libimp/fmt.cpp b/src/libimp/fmt.cpp index f565d17..cb680d5 100644 --- a/src/libimp/fmt.cpp +++ b/src/libimp/fmt.cpp @@ -4,7 +4,7 @@ #include // std::put_time #include // std::ostringstream #include -#include // std::memcpy, std::strncat +#include // std::memcpy #include // std::min #include diff --git a/test/imp/test_imp_fmt.cpp b/test/imp/test_imp_fmt.cpp index 0f3ee95..83df1c0 100644 --- a/test/imp/test_imp_fmt.cpp +++ b/test/imp/test_imp_fmt.cpp @@ -5,7 +5,7 @@ #include "libimp/fmt.h" -TEST(fmt, operator) { +TEST(fmt, spec) { EXPECT_STREQ(imp::spec("hello")(123).fstr.data(), "hello"); EXPECT_EQ(imp::spec("hello")(123).param , 123); EXPECT_STREQ(imp::spec("hello")("world").fstr.data(), "hello"); @@ -81,4 +81,19 @@ TEST(fmt, fmt) { auto s = imp::fmt("hello", " ", "world", "."); EXPECT_EQ(s, "hello world."); std::cout << imp::fmt('[', std::chrono::system_clock::now(), "] ", s) << "\n"; +} + +namespace { + +class foo {}; + +std::string tag_invoke(decltype(imp::fmt_to_string), foo arg) noexcept(false) { + throw arg; + return {}; +} + +} // namespace + +TEST(fmt, throw) { + EXPECT_THROW(imp::fmt(foo{}), foo); } \ No newline at end of file