Fix std::byte formatting with compile-time API (#2072)
* add test for byte formatting with `FMT_COMPILE` * fix byte formatting with `FMT_COMPILE`, use `__cpp_lib_byte` macro * use is not custom mapped type check * workaround MSVC bug
This commit is contained in:
@@ -130,6 +130,9 @@ TEST(CompileTest, FormatDefault) {
|
||||
EXPECT_EQ("foo", fmt::format(FMT_COMPILE("{}"), "foo"));
|
||||
EXPECT_EQ("foo", fmt::format(FMT_COMPILE("{}"), std::string("foo")));
|
||||
EXPECT_EQ("foo", fmt::format(FMT_COMPILE("{}"), test_formattable()));
|
||||
# ifdef __cpp_lib_byte
|
||||
EXPECT_EQ("42", fmt::format(FMT_COMPILE("{}"), std::byte{42}));
|
||||
# endif
|
||||
}
|
||||
|
||||
TEST(CompileTest, FormatWideString) {
|
||||
|
||||
@@ -1762,7 +1762,7 @@ TEST(FormatTest, JoinArg) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
#ifdef __cpp_lib_byte
|
||||
TEST(FormatTest, JoinBytes) {
|
||||
std::vector<std::byte> v = {std::byte(1), std::byte(2), std::byte(3)};
|
||||
EXPECT_EQ("1, 2, 3", fmt::format("{}", fmt::join(v, ", ")));
|
||||
|
||||
Reference in New Issue
Block a user