add additional tests
#define out problematic test for gcc 4
This commit is contained in:
parent
018f654476
commit
57842660b6
@ -519,16 +519,42 @@ TEST(PrintfTest, CheckFormatStringRegression) {
|
|||||||
check_format_string_regression("%c%s", 'x', "");
|
check_format_string_regression("%c%s", 'x', "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST( PrintfTest, VSPrintfMakeArgsExample ) {
|
TEST( PrintfTest, VSPrintfMakeArgsExample ) {
|
||||||
EXPECT_EQ("[42] something happened",
|
fmt::format_arg_store<fmt::printf_context, int, const char *> as{42,
|
||||||
|
"something"};
|
||||||
|
fmt::basic_format_args<fmt::printf_context> args(as);
|
||||||
|
EXPECT_EQ(
|
||||||
|
"[42] something happened", fmt::vsprintf("[%d] %s happened", args));
|
||||||
|
fmt::format_arg_store<fmt::printf_context, int, char[10]> as2 =
|
||||||
|
fmt::make_printf_args(42, "something");
|
||||||
|
fmt::basic_format_args<fmt::printf_context> args2(as2);
|
||||||
|
EXPECT_EQ(
|
||||||
|
"[42] something happened", fmt::vsprintf("[%d] %s happened", args2));
|
||||||
|
//the older gcc versions can"t cast the return value
|
||||||
|
#if !defined(__GNUC__) || (__GNUC__ > 4)
|
||||||
|
EXPECT_EQ(
|
||||||
|
"[42] something happened",
|
||||||
fmt::vsprintf(
|
fmt::vsprintf(
|
||||||
"[%d] %s happened", fmt::make_printf_args(42, "something")));
|
"[%d] %s happened", fmt::make_printf_args(42, "something")));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST( PrintfTest, VSPrintfMakeWArgsExample ) {
|
TEST( PrintfTest, VSPrintfMakeWArgsExample ) {
|
||||||
EXPECT_EQ(L"[42] something happened",
|
fmt::format_arg_store<fmt::wprintf_context, int, const wchar_t *> as{
|
||||||
|
42,L"something"};
|
||||||
|
fmt::basic_format_args<fmt::wprintf_context> args(as);
|
||||||
|
EXPECT_EQ(
|
||||||
|
L"[42] something happened",
|
||||||
|
fmt::vsprintf(L"[%d] %s happened", args));
|
||||||
|
fmt::format_arg_store<fmt::wprintf_context, int, wchar_t[10]> as2 =
|
||||||
|
fmt::make_wprintf_args(42, L"something");
|
||||||
|
fmt::basic_format_args<fmt::wprintf_context> args2( as2 );
|
||||||
|
EXPECT_EQ(
|
||||||
|
L"[42] something happened", fmt::vsprintf(L"[%d] %s happened", args2));
|
||||||
|
#if !defined(__GNUC__) || (__GNUC__ > 4)
|
||||||
|
EXPECT_EQ(
|
||||||
|
L"[42] something happened",
|
||||||
fmt::vsprintf(
|
fmt::vsprintf(
|
||||||
L"[%d] %s happened", fmt::make_wprintf_args(42, L"something")));
|
L"[%d] %s happened", fmt::make_wprintf_args(42, L"something")));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user