format: fix escaped percent before value specifier
This commit is contained in:
parent
0756f3f4cf
commit
6d079554a6
@ -897,7 +897,11 @@ namespace util { namespace format { namespace detail {
|
|||||||
|
|
||||||
specifier spec;
|
specifier spec;
|
||||||
auto cursor = parse (start, last, spec);
|
auto cursor = parse (start, last, spec);
|
||||||
return _render (write (os, spec, val), cursor, last, args...);
|
|
||||||
|
if (spec.k == specifier::kind::ESCAPE)
|
||||||
|
return _render (write (os, spec ), cursor, last, val, args...);
|
||||||
|
else
|
||||||
|
return _render (write (os, spec, val), cursor, last, args...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -162,6 +162,8 @@ main (void)
|
|||||||
CHECK_RENDER ("%% %%", "% %");
|
CHECK_RENDER ("%% %%", "% %");
|
||||||
CHECK_RENDER (" %% %% ", " % % ");
|
CHECK_RENDER (" %% %% ", " % % ");
|
||||||
|
|
||||||
|
CHECK_RENDER ("%%%d%%", "%0%", 0);
|
||||||
|
|
||||||
CHECK_RENDER ("%u %u", "1 2", 1u, 2u);
|
CHECK_RENDER ("%u %u", "1 2", 1u, 2u);
|
||||||
|
|
||||||
CHECK_RENDER ("%#o %o", "010 10", 8u, 8u);
|
CHECK_RENDER ("%#o %o", "010 10", 8u, 8u);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user