Index: base/i18n/message_formatter_unittest.cc |
diff --git a/base/i18n/message_formatter_unittest.cc b/base/i18n/message_formatter_unittest.cc |
index a6f461370c7ffaef00f5971f63ca09139060f4d4..9a0615e069f2278a2d781a01f0b157a63af50c88 100644 |
--- a/base/i18n/message_formatter_unittest.cc |
+++ b/base/i18n/message_formatter_unittest.cc |
@@ -138,10 +138,17 @@ TEST_F(MessageFormatterTest, PluralNumberedArgsWithDate) { |
TEST_F(MessageFormatterTest, DateTimeAndNumber) { |
// Note that using 'mph' for all locales is not a good i18n practice. |
+ // For various ways to format numbers, see |
+ // http://icu-project.org/apiref/icu4c/classicu_1_1MessageFormat.html and |
+ // http://icu-project.org/apiref/icu4c/classicu_1_1DecimalFormat.html |
const string16 pattern = ASCIIToUTF16( |
"At {0,time, short} on {0,date, medium}, " |
"there was {1} at building {2,number,integer}. " |
- "The speed of the wind was {3,number,###.#} mph."); |
+ "The speed of the wind was {3,number,###.#} mph." |
+ "It was a new record {4,number,percent} higher than the previous." |
+ "It was a new record {4,number,##.#%} higher than the previous." |
+ // padding example: '*' followed by a padding symbol. |
+ "We were given {5,number,integer}:{6,number,*0##} for evacuation."); |
using icu::DateFormat; |
std::unique_ptr<DateFormat> tf( |
@@ -155,10 +162,13 @@ TEST_F(MessageFormatterTest, DateTimeAndNumber) { |
expected.append(" on "); |
AppendFormattedDateTime(df, now, &expected); |
expected.append(", there was an explosion at building 3. " |
- "The speed of the wind was 37.4 mph."); |
+ "The speed of the wind was 37.4 mph." |
+ "It was a new record 6% higher than the previous." |
+ "It was a new record 5.8% higher than the previous." |
+ "We were given 3:05 for evacuation."); |
EXPECT_EQ(expected, UTF16ToASCII(MessageFormatter::FormatWithNumberedArgs( |
- pattern, now, "an explosion", 3, 37.413))); |
+ pattern, now, "an explosion", 3, 37.413, 0.0578, 3, 5))); |
} |
TEST_F(MessageFormatterTest, SelectorSingleOrMultiple) { |