mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-29 13:21:05 +00:00
Fix example.
This commit is contained in:
parent
c3b3c0fafe
commit
5415b2a43b
2
format.h
2
format.h
@ -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
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user