From d29f31851e784bd81a3a06bfe9d43b402e68ea79 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Thu, 13 Dec 2012 08:01:47 -0800 Subject: [PATCH] Add a test from example. --- format_test.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/format_test.cc b/format_test.cc index fe1c2498..6055635c 100644 --- a/format_test.cc +++ b/format_test.cc @@ -665,11 +665,19 @@ TEST(FormatterTest, FormatterAppend) { EXPECT_EQ("part1part2", format.str()); } -TEST(FormatterTest, FormatterExample) { +TEST(FormatterTest, FormatterExamples) { Formatter format; format("Current point:\n"); format("({0:+f}, {1:+f})\n") << -3.14 << 3.14; EXPECT_EQ("Current point:\n(-3.140000, +3.140000)\n", format.str()); + + { + fmt::Formatter format; + for (int i = 0; i < 10; i++) + format("{0}") << i; + std::string s = format.str(); // s == 0123456789 + EXPECT_EQ("0123456789", s); + } } TEST(FormatterTest, ArgInserter) {