std::string double percent Format bug fix

This commit is contained in:
Aleksandar Fabijanic 2007-04-28 19:13:21 +00:00
parent cf20ff1bd7
commit d740264009
2 changed files with 8 additions and 2 deletions

View File

@ -356,8 +356,8 @@ void format(std::string& result, const std::string& fmt, const std::vector<Any>&
++itFmt;
if (itFmt != endFmt && itVal != endVal)
formatOne(result, itFmt, endFmt, itVal);
else
result += *itFmt;
else if (itFmt != endFmt)
result += *itFmt++;
break;
default:
result += *itFmt;

View File

@ -318,6 +318,12 @@ void FormatTest::testString()
s = format("%-5s", foo);
assert (s == "foo ");
s = format("%s%%a", foo);
assert (s == "foo%a");
s = format("'%s%%''%s%%'", foo, foo);
assert (s == "'foo%''foo%'");
}