From d8a696fb5f4b7968fcfb3f81e139c6038007cea1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 30 Mar 2009 22:23:05 +0000 Subject: [PATCH] correct French short date format for glibc; added more detailed messages for failing tests git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59954 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- tests/intl/intltest.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/tests/intl/intltest.cpp b/tests/intl/intltest.cpp index b5c34d9b03..40f31f06bd 100644 --- a/tests/intl/intltest.cpp +++ b/tests/intl/intltest.cpp @@ -123,7 +123,8 @@ void IntlTestCase::Headers() CPPUNIT_ASSERT_EQUAL( "", m_locale->GetHeaderValue("X-Not-Here") ); } -static void CompareFormats(const wxString& expected, wxString actual) +static void +CompareFormats(const char *msg, const wxString& expected, wxString actual) { if ( actual.empty() ) { @@ -138,7 +139,7 @@ static void CompareFormats(const wxString& expected, wxString actual) actual.Replace("%e", "%d"); #endif // __GLIBC__ - CPPUNIT_ASSERT_EQUAL( expected, actual ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( msg, expected, actual ); } void IntlTestCase::DateTimeFmt() @@ -149,25 +150,31 @@ void IntlTestCase::DateTimeFmt() #ifdef __GLIBC__ // glibc also uses dots for French locale separator for some reason (the // standard format uses slashes) - static const char *FRENCH_DATE_FMT = "%d.%m.%y"; + static const char *FRENCH_DATE_FMT = "%d.%m.%Y"; #else static const char *FRENCH_DATE_FMT = "%d/%m/%y"; #endif - CompareFormats( FRENCH_DATE_FMT, m_locale->GetInfo(wxLOCALE_SHORT_DATE_FMT) ); - CompareFormats( "%a %d %b %Y", m_locale->GetInfo(wxLOCALE_LONG_DATE_FMT) ); - CompareFormats( "%a %d %b %Y %H:%M:%S %Z", + CompareFormats( "French short date", FRENCH_DATE_FMT, + m_locale->GetInfo(wxLOCALE_SHORT_DATE_FMT) ); + CompareFormats( "French long date", "%a %d %b %Y", + m_locale->GetInfo(wxLOCALE_LONG_DATE_FMT) ); + CompareFormats( "French date and time", "%a %d %b %Y %H:%M:%S %Z", m_locale->GetInfo(wxLOCALE_DATE_TIME_FMT) ); - CompareFormats( "%H:%M:%S", m_locale->GetInfo(wxLOCALE_TIME_FMT) ); + CompareFormats( "French time", "%H:%M:%S", + m_locale->GetInfo(wxLOCALE_TIME_FMT) ); // also test for "C" locale setlocale(LC_ALL, "C"); - CompareFormats( "%m/%d/%y", m_locale->GetInfo(wxLOCALE_SHORT_DATE_FMT) ); - CompareFormats( "%a %b %d %Y", m_locale->GetInfo(wxLOCALE_LONG_DATE_FMT) ); - CompareFormats( "%a %b %d %H:%M:%S %Y", + CompareFormats( "C short date", "%m/%d/%y", + m_locale->GetInfo(wxLOCALE_SHORT_DATE_FMT) ); + CompareFormats( "C long date", "%a %b %d %Y", + m_locale->GetInfo(wxLOCALE_LONG_DATE_FMT) ); + CompareFormats( "C date and time", "%a %b %d %H:%M:%S %Y", m_locale->GetInfo(wxLOCALE_DATE_TIME_FMT) ); - CompareFormats( "%H:%M:%S", m_locale->GetInfo(wxLOCALE_TIME_FMT) ); + CompareFormats( "C time", "%H:%M:%S", + m_locale->GetInfo(wxLOCALE_TIME_FMT) ); } #endif // wxUSE_INTL