Changeset 2162 for trunk


Ignore:
Timestamp:
Jul 3, 2005, 2:39:06 AM (20 years ago)
Author:
bird
Message:

extended the test a bit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libctests/glibc/locale/tst-C-locale.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2161 r2162  
    3636  const wchar_t *wstr;
    3737  int result = 0;
     38#ifdef HAVE_NEWLOCALE
    3839  locale_t loc;
     40#endif
    3941
    4042  /* ISO C stuff.  */
     
    167169  STRTEST (NOEXPR, "^[nN]");
    168170
     171#ifdef HAVE_NL_LANGINFO_EXTENTIONS
    169172  /* Extensions.  */
    170173  WSTRTEST (_NL_WABDAY_1, L"Sun");
     
    228231  STRTEST (NEGATIVE_SIGN, "");
    229232  STRTEST (GROUPING, "");
     233#endif /* HAVE_NL_LANGINFO_EXTENTIONS */
    230234
    231235  STRTEST (YESSTR, "");
    232236  STRTEST (NOSTR, "");
    233237
     238
     239#ifdef HAVE_NEWLOCALE
    234240  /* Test the new locale mechanisms.  */
    235241  loc = newlocale (LC_ALL_MASK, locname, NULL);
     
    464470      freelocale (loc);
    465471    }
     472#endif /* HAVE_NEWLOCALE */
    466473
    467474  return result;
     
    492499    result |= run_test ("POSIX");
    493500
     501  /* Replace the locale, set it back to C and retry.  */
     502  if (   setlocale (LC_ALL, "jp_JP") != NULL
     503      || setlocale (LC_ALL, "jp") != NULL
     504      || setlocale (LC_ALL, "de_DE") != NULL
     505      || setlocale (LC_ALL, "no_NO") != NULL
     506      || setlocale (LC_ALL, "en_US") != NULL
     507      || setlocale (LC_ALL, "en") != NULL
     508      )
     509    {
     510      /* First use the name "C".  */
     511      if (setlocale (LC_ALL, "C") == NULL)
     512        {
     513          puts ("cannot set C locale");
     514          result = 1;
     515        }
     516      else
     517        result = run_test ("Retest C");
     518
     519      /* Then the name "POSIX".  */
     520      if (setlocale (LC_ALL, "POSIX") == NULL)
     521        {
     522          puts ("cannot set POSIX locale");
     523          result = 1;
     524        }
     525      else
     526        result |= run_test ("Retest POSIX");
     527    }
     528  else
     529    puts ("Skipping last test since we fail to find a valid locale.");
     530
    494531  return result;
    495532}
Note: See TracChangeset for help on using the changeset viewer.