fixed GH# 65: Poco::format() misorders sign and padding specifiers

This commit is contained in:
Guenter Obiltschnig 2013-05-24 23:54:15 +02:00
parent 173f205cb6
commit 0434ee2b6b
2 changed files with 4 additions and 2 deletions

View File

@ -57,9 +57,9 @@ namespace
switch (*itFmt)
{
case '-': str.setf(std::ios::left); ++itFmt; break;
case '+': str.setf(std::ios::showpos); ++itFmt; break;
case '+': str.setf(std::ios::showpos | std::ios::internal); ++itFmt; break;
case '0': str.fill('0'); ++itFmt; break;
case '#': str.setf(std::ios::showpoint | std::ios_base::showbase); ++itFmt; break;
case '#': str.setf(std::ios::showpoint | std::ios::showbase); ++itFmt; break;
default: isFlag = false; break;
}
}

View File

@ -172,6 +172,8 @@ void FormatTest::testInt()
i = -42;
s = format("%+d", i);
assert (s == "-42");
s = format("%+04d", i);
assert (s == "-042");
s = format("%d", i);
assert (s == "-42");