X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9a83f860948059b0273b5cc6d9e43fadad3ebfca..791f7574a08f7dacdb006b5788ae738a4134ca85:/tests/strings/strings.cpp?ds=sidebyside diff --git a/tests/strings/strings.cpp b/tests/strings/strings.cpp index 98b5230666..92dff3e994 100644 --- a/tests/strings/strings.cpp +++ b/tests/strings/strings.cpp @@ -602,6 +602,17 @@ void StringTestCase::ToLong() if ( ld.IsOk() ) CPPUNIT_ASSERT_EQUAL( ld.LValue(), l ); } + + // special case: check that the output is not modified if the parsing + // failed completely + l = 17; + CPPUNIT_ASSERT( !wxString("foo").ToLong(&l) ); + CPPUNIT_ASSERT_EQUAL( 17, l ); + + // also check that it is modified if we did parse something successfully in + // the beginning of the string + CPPUNIT_ASSERT( !wxString("9 cats").ToLong(&l) ); + CPPUNIT_ASSERT_EQUAL( 9, l ); } void StringTestCase::ToULong()