Add more tests for BMessageFormat.

* Negative and null values, big values, thousands separators (in
different languages), string with no format, non-printable and non-utf8
charcaters, format not using # for the number.
This commit is contained in:
Adrien Destugues
2014-10-21 12:21:50 +02:00
parent c06fd79574
commit d341a585ae
+20 -2
View File
@@ -47,8 +47,26 @@ MessageFormatTest::TestFormat()
"few{# объекта} other{# объектов}}";
static const Test tests[] = {
{"en_US", "{0, plural, one{# dog} other{# dogs}}", 1, "1 dog"},
{"en_US", "{0, plural, one{# dog} other{# dogs}}", 2, "2 dogs"},
{"en_US", "A QA engineer walks into a bar.", 0,
"A QA engineer walks into a bar."},
{"en_US", "Orders {0, plural, one{# beer} other{# beers}}.", 1,
"Orders 1 beer."},
{"en_US", "Orders {0, plural, one{# beer} other{# beers}}.", 0,
"Orders 0 beers."},
{"en_US", "Orders {0, plural, one{# beer} other{# beers}}.", 99999999,
"Orders 99,999,999 beers."},
{"en_US", "Orders {0, plural, one{# beer} other{# beers}}.", -INT_MAX,
"Orders -2,147,483,647 beers."},
{"en_US", "Orders {0, plural, one{# beer} other{# beers}}.", -1,
"Orders -1 beer."},
{"en_US", "Orders {0, plural, one{a lizard} other{more lizards}}.", 1,
"Orders a lizard."},
{"en_US", "Orders {0, plural, one{a lizard} other{more lizards}}.", 2,
"Orders more lizards."},
{"en_US", "Orders {0, plural, one{# \x8A} other{# \x02}}.", 2,
"Orders 2 \x02."},
{"fr_FR", "Commande {0, plural, one{# bière} other{# bières}}.",
99999999, "Commande 99 999 999 bières."},
{"pl_PL", polishTemplate, 1, "Wybrano 1 obiekt"},
{"pl_PL", polishTemplate, 3, "Wybrano 3 obiekty"},
{"pl_PL", polishTemplate, 5, "Wybrano 5 obiektów"},