Chromium Code Reviews| Index: base/i18n/time_formatting_unittest.cc |
| diff --git a/base/i18n/time_formatting_unittest.cc b/base/i18n/time_formatting_unittest.cc |
| index 06cd77284a61b388e0f12f13778dda8da3f4862b..74d0e4fa3897b1b8a395b9056809b555b25e5f1f 100644 |
| --- a/base/i18n/time_formatting_unittest.cc |
| +++ b/base/i18n/time_formatting_unittest.cc |
| @@ -224,6 +224,33 @@ TEST(TimeFormattingTest, MAYBE_TimeFormatDateGB) { |
| TimeFormatFriendlyDate(time)); |
| } |
| +TEST(TimeFormattingTest, TimeFormatWithPattern) { |
| + test::ScopedRestoreICUDefaultLocale restore_locale; |
| + |
| + Time time; |
| + EXPECT_TRUE(Time::FromLocalExploded(kTestDateTimeExploded, &time)); |
| + |
| + i18n::SetICUDefaultLocale("en_US"); |
|
jungshik at Google
2017/01/26 19:29:14
Thank for adding tests.
I'm sorry that I forgot
jiahuiguo
2017/01/27 09:31:05
Thanks for the comments, separate to different uni
|
| + EXPECT_EQ(ASCIIToUTF16("Apr 30, 2011"), TimeFormatWithPattern(time, "yMMMd")); |
| + EXPECT_EQ(ASCIIToUTF16("April 30, 3:42:07 PM"), |
| + TimeFormatWithPattern(time, "MMMMdjmmss")); |
| + |
| + i18n::SetICUDefaultLocale("en_GB"); |
| + EXPECT_EQ(ASCIIToUTF16("30 Apr 2011"), TimeFormatWithPattern(time, "yMMMd")); |
| + EXPECT_EQ(ASCIIToUTF16("30 April, 15:42:07"), |
| + TimeFormatWithPattern(time, "MMMMdjmmss")); |
| + |
| + i18n::SetICUDefaultLocale("ja_JP"); |
| + EXPECT_EQ(WideToUTF16(L"2011\x5e74" |
| + L"4\x6708" |
| + L"30\x65e5"), |
|
jungshik at Google
2017/01/26 19:29:14
Now that every compiler we use support UTF-16 stri
jiahuiguo
2017/01/27 09:31:05
Actually if we use u"2011年4月30日" as the first para
|
| + TimeFormatWithPattern(time, "yMMMd")); |
| + EXPECT_EQ(WideToUTF16(L"4\x6708" |
| + L"30\x65e5") + |
| + ASCIIToUTF16(" 15:42:07"), |
| + TimeFormatWithPattern(time, "MMMMdjmmss")); |
| +} |
| + |
| TEST(TimeFormattingTest, TimeDurationFormat) { |
| test::ScopedRestoreICUDefaultLocale restore_locale; |
| TimeDelta delta = TimeDelta::FromMinutes(15 * 60 + 42); |