[libc++][test] Use the Japanese locale.

This change is done to see whether all platforms have a CI with the
Japanese locale installed.

This wires in the locale in the tests and uses it in one test. This is
a preparation for the tests of the chrono formatters.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D122738
This commit is contained in:
Mark de Wever 2022-03-30 17:34:17 +02:00
parent 7dcd698875
commit d49c0ba5ab
3 changed files with 16 additions and 1 deletions

View File

@ -11,6 +11,7 @@
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.fr_FR.UTF-8
// REQUIRES: locale.ja_JP.UTF-8
// <locale>
@ -75,6 +76,18 @@ int main(int, char**)
(ex == "Today is samedi which is abbreviated 'sam'." )||
(ex == "Today is samedi which is abbreviated 'sam.'."));
}
{
const my_facet f(LOCALE_ja_JP_UTF_8, 1);
std::string pat("Today is %A which is the %uth day or alternatively %Ou.");
cpp17_output_iterator<char*> iter =
f.put(cpp17_output_iterator<char*>(str), ios, '*', &t, pat.data(), pat.data() + pat.size());
std::string ex(str, base(iter));
#if defined(_WIN32) || defined(__APPLE__)
// These platforms have no alternative
assert(ex == "Today is \xE5\x9C\x9F\xE6\x9B\x9C\xE6\x97\xA5 which is the 6th day or alternatively 6.");
#else
assert(ex == "Today is \xE5\x9C\x9F\xE6\x9B\x9C\xE6\x97\xA5 which is the 6th day or alternatively \xE5\x85\xAD.");
#endif
}
return 0;
}

View File

@ -28,6 +28,7 @@
# define LOCALE_fr_CA_ISO8859_1 "fr_CA.ISO8859-1"
# define LOCALE_cs_CZ_ISO8859_2 "cs_CZ.ISO8859-2"
#endif
#define LOCALE_ja_JP_UTF_8 "ja_JP.UTF-8"
#define LOCALE_ru_RU_UTF_8 "ru_RU.UTF-8"
#define LOCALE_zh_CN_UTF_8 "zh_CN.UTF-8"

View File

@ -193,6 +193,7 @@ for macro, feature in macros.items():
locales = {
'en_US.UTF-8': ['en_US.UTF-8', 'en_US.utf8', 'English_United States.1252'],
'fr_FR.UTF-8': ['fr_FR.UTF-8', 'fr_FR.utf8', 'French_France.1252'],
'ja_JP.UTF-8': ['ja_JP.UTF-8', 'ja_JP.utf8', 'Japanese_Japan.923'],
'ru_RU.UTF-8': ['ru_RU.UTF-8', 'ru_RU.utf8', 'Russian_Russia.1251'],
'zh_CN.UTF-8': ['zh_CN.UTF-8', 'zh_CN.utf8', 'Chinese_China.936'],
'fr_CA.ISO8859-1': ['fr_CA.ISO8859-1', 'French_Canada.1252'],