Add dynamic width support to FMT_COMPILE (#1809)

This commit is contained in:
Victor Zverovich
2020-08-10 09:13:13 -07:00
parent 6fb7c6fb25
commit 54daa0864a
3 changed files with 18 additions and 9 deletions

View File

@@ -153,6 +153,11 @@ TEST(CompileTest, FormatSpecs) {
EXPECT_EQ("42", fmt::format(FMT_COMPILE("{:x}"), 0x42));
}
TEST(CompileTest, DynamicWidth) {
EXPECT_EQ(" 42foo ",
fmt::format(FMT_COMPILE("{:{}}{:{}}"), 42, 4, "foo", 5));
}
TEST(CompileTest, FormatTo) {
char buf[8];
auto end = fmt::format_to(buf, FMT_COMPILE("{}"), 42);