Fixed tests for format strings containing \0

This commit is contained in:
Artem Golubikhin 2017-12-06 19:48:24 +03:00 committed by GitHub
parent 5a4188afc9
commit 89451299eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,6 +57,7 @@ using fmt::basic_writer;
using fmt::format;
using fmt::format_error;
using fmt::string_view;
using fmt::wstring_view;
using fmt::memory_buffer;
using fmt::wmemory_buffer;
using fmt::fill;
@ -1470,9 +1471,9 @@ TEST(LiteralsTest, Format) {
EXPECT_EQ(format(L"{}c{}", L"ab", 1), udl_format_w);
auto udl_format_null_char = "{}c\0d{}"_format("ab", 1);
EXPECT_EQ(format("{}c\0d{}", "ab", 1), udl_format_null_char);
EXPECT_EQ(string_view("abc\0d1", 6), udl_format_null_char);
auto udl_format_w_null_char = L"{}c\0d{}"_format(L"ab", 1);
EXPECT_EQ(format(L"{}c\0d{}", L"ab", 1), udl_format_w_null_char);
EXPECT_EQ(wstring_view(L"abc\0d1", 6), udl_format_w_null_char);
}
TEST(LiteralsTest, NamedArg) {
@ -1533,7 +1534,7 @@ TEST(FormatTest, CustomArgFormatter) {
TEST(FormatTest, NonNullTerminatedFormatString) {
EXPECT_EQ("42", format(string_view("{}foo", 2), 42));
EXPECT_EQ("42f\0oo", format(string_view("{}f\0oo", 6), 42));
EXPECT_EQ(string_view("42f\0oo", 6), format(string_view("{}f\0oo", 6), 42));
}
struct variant {