You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by ca...@apache.org on 2005/03/18 23:37:10 UTC

cvs commit: logging-log4cxx/tests/src/helpers localechanger.cpp cacheddateformattestcase.cpp datetimedateformattestcase.cpp

carnold     2005/03/18 14:37:10

  Modified:    tests/src/helpers localechanger.cpp
                        cacheddateformattestcase.cpp
                        datetimedateformattestcase.cpp
  Log:
  LOGCXX-49: Fixed LocaleChanger ensuring isEff() == false if locale is not available
  
  Revision  Changes    Path
  1.3       +1 -0      logging-log4cxx/tests/src/helpers/localechanger.cpp
  
  Index: localechanger.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/tests/src/helpers/localechanger.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- localechanger.cpp	16 Mar 2005 16:39:24 -0000	1.2
  +++ localechanger.cpp	18 Mar 2005 22:37:10 -0000	1.3
  @@ -24,6 +24,7 @@
   * @param locale locale.
   */
   LocaleChanger::LocaleChanger(const char* locale) {
  +    effective = false;
       try {
           std::locale newLocale(locale);
           initial = std::locale::global(newLocale);
  
  
  
  1.12      +16 -14    logging-log4cxx/tests/src/helpers/cacheddateformattestcase.cpp
  
  Index: cacheddateformattestcase.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/tests/src/helpers/cacheddateformattestcase.cpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- cacheddateformattestcase.cpp	19 Feb 2005 01:59:37 -0000	1.11
  +++ cacheddateformattestcase.cpp	18 Mar 2005 22:37:10 -0000	1.12
  @@ -227,20 +227,22 @@
       //     are optimized to reuse previous formatted value
       //     make a couple of nearly spaced calls
       LocaleChanger localeChange(LOCALE_JP);
  -    DateFormatPtr baseFormat(new SimpleDateFormat(
  -               LOG4CXX_STR("EEE, MMM dd, HH:mm:ss.SSS Z")));
  -    CachedDateFormat cachedFormat(baseFormat, 1000000);
  -    //
  -    //   use a date in 2000 to attempt to confuse the millisecond locator
  -    apr_time_t ticks = MICROSECONDS_PER_DAY * 11141;
  -
  -    Pool p;
  -
  -    assertFormattedEquals(baseFormat, cachedFormat, ticks, p);
  -    assertFormattedEquals(baseFormat, cachedFormat, ticks + 8000, p);
  -    assertFormattedEquals(baseFormat, cachedFormat, ticks + 17000, p);
  -    assertFormattedEquals(baseFormat, cachedFormat, ticks + 237000, p);
  -    assertFormattedEquals(baseFormat, cachedFormat, ticks + 1415000, p);
  +    if (localeChange.isEffective()) {
  +        DateFormatPtr baseFormat(new SimpleDateFormat(
  +                   LOG4CXX_STR("EEE, MMM dd, HH:mm:ss.SSS Z")));
  +        CachedDateFormat cachedFormat(baseFormat, 1000000);
  +        //
  +        //   use a date in 2000 to attempt to confuse the millisecond locator
  +        apr_time_t ticks = MICROSECONDS_PER_DAY * 11141;
  +
  +        Pool p;
  +
  +        assertFormattedEquals(baseFormat, cachedFormat, ticks, p);
  +        assertFormattedEquals(baseFormat, cachedFormat, ticks + 8000, p);
  +        assertFormattedEquals(baseFormat, cachedFormat, ticks + 17000, p);
  +        assertFormattedEquals(baseFormat, cachedFormat, ticks + 237000, p);
  +        assertFormattedEquals(baseFormat, cachedFormat, ticks + 1415000, p);
  +    }
     }
   
     /**
  
  
  
  1.12      +1 -4      logging-log4cxx/tests/src/helpers/datetimedateformattestcase.cpp
  
  Index: datetimedateformattestcase.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/tests/src/helpers/datetimedateformattestcase.cpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- datetimedateformattestcase.cpp	18 Mar 2005 02:20:20 -0000	1.11
  +++ datetimedateformattestcase.cpp	18 Mar 2005 22:37:10 -0000	1.12
  @@ -52,10 +52,7 @@
     CPPUNIT_TEST( test4 );
     CPPUNIT_TEST( test5 );
     CPPUNIT_TEST( test6 );
  -//  Unexpectedly failing on Gump machine, 
  -//   LocaleChanger not catching exception on locale creation failure
  -//   despite catch blocks.
  -//  CPPUNIT_TEST( test7 );
  +  CPPUNIT_TEST( test7 );
     CPPUNIT_TEST( test8 );
     CPPUNIT_TEST_SUITE_END();