improve test, fix conditional
This commit is contained in:
parent
45b9f9637e
commit
98a35576c8
@ -1807,18 +1807,25 @@ fmt::string_view to_string_view(string_like) { return "foo"; }
|
||||
|
||||
constexpr char with_null[3] = {'{', '}', '\0'};
|
||||
constexpr char no_null[2] = {'{', '}'};
|
||||
static FMT_CONSTEXPR_DECL const char static_with_null[3] = {'{', '}', '\0'};
|
||||
static FMT_CONSTEXPR_DECL const wchar_t static_with_null_wide[3] = {'{', '}', '\0'};
|
||||
static FMT_CONSTEXPR_DECL const char static_no_null[2] = {'{', '}'};
|
||||
static FMT_CONSTEXPR_DECL const wchar_t static_no_null_wide[2] = {'{', '}'};
|
||||
|
||||
TEST(FormatTest, CompileTimeString) {
|
||||
static FMT_CONSTEXPR_DECL const char static_with_null[3] = {'{', '}', '\0'};
|
||||
static FMT_CONSTEXPR_DECL const wchar_t static_with_null_wide[3] = {'{', '}', '\0'};
|
||||
|
||||
EXPECT_EQ("42", fmt::format(FMT_STRING("{}"), 42));
|
||||
EXPECT_EQ(L"42", fmt::format(FMT_STRING(L"{}"), 42));
|
||||
EXPECT_EQ("foo", fmt::format(FMT_STRING("{}"), string_like()));
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1927
|
||||
(void)static_with_null;
|
||||
(void)static_with_null_wide;
|
||||
(void)static_no_null;
|
||||
(void)static_no_null_wide;
|
||||
#if !defined(_MSC_VER)
|
||||
EXPECT_EQ("42", fmt::format(FMT_STRING(static_with_null), 42));
|
||||
EXPECT_EQ(L"42", fmt::format(FMT_STRING(static_with_null_wide), 42));
|
||||
EXPECT_EQ("42", fmt::format(FMT_STRING(static_no_null), 42));
|
||||
EXPECT_EQ(L"42", fmt::format(FMT_STRING(static_no_null_wide), 42));
|
||||
#endif
|
||||
|
||||
(void)with_null;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user