Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion tests/std/tests/P0645R10_text_formatting_formatting/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <string_view>

using namespace std;

// TODO: fill in tests
template back_insert_iterator<string> std::vformat_to(
back_insert_iterator<string>, const locale&, string_view, format_args_t<back_insert_iterator<string>, char>);
Expand Down Expand Up @@ -75,5 +74,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"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We conventionally avoid C-style casts everywhere (because they can do so many things, and are impossible to search for). Occurs below.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also say, that we should fix the bug and not try to work around it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're going to merge and fix the bug in a PR, just because that unblocks Elnar and I have to get a foot X-Ray before fixing the overload set

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;
}