Fix example.

This commit is contained in:
Victor Zverovich 2014-05-14 08:20:20 -07:00
parent c3b3c0fafe
commit 5415b2a43b
2 changed files with 2 additions and 1 deletions

View File

@ -1728,7 +1728,7 @@ inline Formatter<ANSITerminalSink> PrintColored(Color c, StringRef format) {
**Example**::
std::string message = str(Format("The answer is {}", 42);
std::string message = str(Format("The answer is {}", 42));
See also `Format String Syntax`_.
\endrst

View File

@ -1796,6 +1796,7 @@ TEST(FormatterTest, Examples) {
ReportError("File not found: {0}") << path;
#if FMT_USE_VARIADIC_TEMPLATES && FMT_USE_RVALUE_REFERENCES
EXPECT_EQ("The answer is 42", str(Format("The answer is {}", 42)));
EXPECT_THROW_MSG(
Format("The answer is {:d}", "forty-two"), FormatError,
"unknown format code 'd' for string");