From fca0679b60fc0340c38dd6501691ff4bc10d6c2d Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 22 Feb 2021 13:15:19 -0800 Subject: [PATCH 1/2] initial replacement field tests (and numeric arg indexing) --- .../test.cpp | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/std/tests/P0645R10_text_formatting_formatting/test.cpp b/tests/std/tests/P0645R10_text_formatting_formatting/test.cpp index 1c97b8de8ae..3890c34375a 100644 --- a/tests/std/tests/P0645R10_text_formatting_formatting/test.cpp +++ b/tests/std/tests/P0645R10_text_formatting_formatting/test.cpp @@ -9,7 +9,7 @@ #include using namespace std; - +using namespace std::string_view_literals; // TODO: fill in tests template back_insert_iterator std::vformat_to( back_insert_iterator, const locale&, string_view, format_args_t, char>); @@ -75,5 +75,26 @@ int main() { vformat_to(back_insert_iterator(output_string), locale::classic(), "}}x", make_format_args()); assert(output_string == "}x"); + output_string.clear(); + vformat_to(back_insert_iterator(output_string), locale::classic(), "{}", make_format_args((const char*) "f")); + assert(output_string == "f"); + + output_string.clear(); + vformat_to(back_insert_iterator(output_string), locale::classic(), "{0} {0}", make_format_args((const char*) "f")); + assert(output_string == "f f"); + + // TODO: enable these in _Write function PR for sv and bool + /* + output_string.clear(); + vformat_to(back_insert_iterator(output_string), locale::classic(), "{}", make_format_args("f"sv)); + assert(output_string == "f"); + */ + + /* + output_string.clear(); + vformat_to(back_insert_iterator(output_string), locale::classic(), "{}", make_format_args(true)); + assert(output_string == "true"); + */ + return 0; } From bb3b6ccc5008fe794a1f0defdd2a6a521230fe04 Mon Sep 17 00:00:00 2001 From: Charlie Date: Wed, 24 Feb 2021 10:50:04 -0800 Subject: [PATCH 2/2] don't need to use the string_view_literals namespace. --- tests/std/tests/P0645R10_text_formatting_formatting/test.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/std/tests/P0645R10_text_formatting_formatting/test.cpp b/tests/std/tests/P0645R10_text_formatting_formatting/test.cpp index 3890c34375a..662d331fa6f 100644 --- a/tests/std/tests/P0645R10_text_formatting_formatting/test.cpp +++ b/tests/std/tests/P0645R10_text_formatting_formatting/test.cpp @@ -9,7 +9,6 @@ #include using namespace std; -using namespace std::string_view_literals; // TODO: fill in tests template back_insert_iterator std::vformat_to( back_insert_iterator, const locale&, string_view, format_args_t, char>);