COMMON: Fix handling escaped percents in Common::U32String::format

This commit is contained in:
Cameron Cawley 2022-11-15 18:42:29 +00:00 committed by Eugene Sandulenko
parent 29024cded7
commit 3441c7230d
2 changed files with 6 additions and 0 deletions

View File

@ -236,6 +236,10 @@ int U32String::vformat(const value_type *fmt, const value_type *fmtEnd, U32Strin
output.insertChar(int_temp, pos);
++length;
break;
case '%':
output.insertChar('%', pos);
++length;
break;
default:
warning("Unexpected formatting type for U32String::Format.");
break;

View File

@ -377,6 +377,8 @@ class StringTestSuite : public CxxTest::TestSuite
TS_ASSERT_EQUALS( Common::U32String::format("%d", 0).encode(), "0" );
TS_ASSERT_EQUALS( Common::U32String::format("%d", 1234).encode(), "1234" );
TS_ASSERT_EQUALS( Common::U32String::format("%d", -1234).encode(), "-1234" );
TS_ASSERT_EQUALS( Common::U32String::format("%u %%", 100).encode(), "100 %" );
}
void test_strlcpy() {