From 2cf0537722df9803abd4a6de9b9a2c2a195ed414 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 9 May 2020 23:20:06 +0200 Subject: [PATCH] Correct the test for ParseFormat() with fall back date This was added back in b5f85206a9 (fix ParseFormat("%d") to set the date it finds (#10002), 2008-09-26), but the test didn't do what the comment said and didn't use the default date object it added. Fix this now to finally do what was intended all these years ago. --- tests/datetime/datetimetest.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/datetime/datetimetest.cpp b/tests/datetime/datetimetest.cpp index aa0a96c602..1638afe0ba 100644 --- a/tests/datetime/datetimetest.cpp +++ b/tests/datetime/datetimetest.cpp @@ -870,8 +870,10 @@ void DateTimeTestCase::TestTimeFormat() // test partially specified dates too wxDateTime dtDef(26, wxDateTime::Sep, 2008); - CPPUNIT_ASSERT( dt.ParseFormat("17", "%d") ); + CPPUNIT_ASSERT( dt.ParseFormat("17", "%d", dtDef) ); CPPUNIT_ASSERT_EQUAL( 17, dt.GetDay() ); + CPPUNIT_ASSERT_EQUAL( wxDateTime::Sep, dt.GetMonth() ); + CPPUNIT_ASSERT_EQUAL( 2008, dt.GetYear() ); // test some degenerate cases CPPUNIT_ASSERT( !dt.ParseFormat("", "%z") );