Restore value of errno after wxString::ToInt()/Long()/etc.
Such functions modifying errno is undocumented, and may come as a surprise to the caller. Consequently also a call to wxString::Format() would modify errno.
This commit is contained in:
parent
0c97244747
commit
ed897d9641
2 changed files with 28 additions and 0 deletions
|
|
@ -172,6 +172,16 @@ void StringTestCase::Format()
|
|||
CPPUNIT_ASSERT_EQUAL( len, wxString::Format(wxT("%s"), s.c_str()).length());
|
||||
}
|
||||
|
||||
int errnoWas = errno;
|
||||
// wxString::Format() should not modify errno
|
||||
errno = 1234;
|
||||
wxString::Format("abc %d %d", 1, 1);
|
||||
CPPUNIT_ASSERT_EQUAL
|
||||
(
|
||||
1234,
|
||||
errno
|
||||
);
|
||||
errno = errnoWas;
|
||||
|
||||
// Positional parameters tests:
|
||||
CPPUNIT_ASSERT_EQUAL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue