From ab2f8484e0923d44dd4c3fad53d0eed48116021b Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 14 Jun 2020 11:04:41 -0700 Subject: [PATCH] Finish text::format --- include/fmt/compile.h | 3 +-- test/compile-test.cc | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/fmt/compile.h b/include/fmt/compile.h index 0c37adc4..9ec15474 100644 --- a/include/fmt/compile.h +++ b/include/fmt/compile.h @@ -378,8 +378,7 @@ template struct text { template OutputIt format(OutputIt out, const Args&...) const { - // TODO: reserve - return copy_str(data.begin(), data.end(), out); + return write(out, data); } }; diff --git a/test/compile-test.cc b/test/compile-test.cc index e17e07db..83f8327c 100644 --- a/test/compile-test.cc +++ b/test/compile-test.cc @@ -155,4 +155,8 @@ TEST(CompileTest, FormatDefault) { EXPECT_EQ("foo", fmt::format(FMT_COMPILE("{}"), "foo")); EXPECT_EQ("foo", fmt::format(FMT_COMPILE("{}"), std::string("foo"))); } + +TEST(CompileTest, TextAndArg) { + EXPECT_EQ(">>>42<<<", fmt::format(FMT_COMPILE(">>>{}<<<"), 42)); +} #endif