From 19dcdd94310c9a6aedb80e8b9570334fc7d24f6a Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 5 Sep 2014 11:42:52 -0700 Subject: Mark libcore.java.text.DecimalFormatSymbolsTest#test_getInstance_unknown_or_invalid_locale a known failure. The good news is that for the first time we understand why this is failing. Too big to fix for L though, and not a regression. Bug: 17374604 (cherry-picked from commit f887ab7ef74d3ca821aca63ccee2c86cc6a42489) Change-Id: I589fe2eae0643e07e8db8cbcc7df52563aa24604 --- .../libcore/java/text/DecimalFormatSymbolsTest.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'luni') diff --git a/luni/src/test/java/libcore/java/text/DecimalFormatSymbolsTest.java b/luni/src/test/java/libcore/java/text/DecimalFormatSymbolsTest.java index 8b24c6d..619c38e 100644 --- a/luni/src/test/java/libcore/java/text/DecimalFormatSymbolsTest.java +++ b/luni/src/test/java/libcore/java/text/DecimalFormatSymbolsTest.java @@ -24,18 +24,21 @@ import java.text.DecimalFormatSymbols; import java.util.Locale; public class DecimalFormatSymbolsTest extends junit.framework.TestCase { - private void checkLocaleIsEquivalentToRoot(Locale locale) { - DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(locale); - assertEquals(DecimalFormatSymbols.getInstance(Locale.ROOT), dfs); - } public void test_getInstance_unknown_or_invalid_locale() throws Exception { - // TODO: we fail these tests because ROOT has "INF" for infinity but 'dfs' has "\u221e". - // On the RI, ROOT has "\u221e" too, but DecimalFormatSymbols.equals appears to be broken; - // it returns false for objects that -- if you compare their externally visible state -- - // are equal. It could be that they're accidentally checking the Locale. + // http://b/17374604: this test passes on the host but fails on the target. + // ICU uses setlocale(3) to determine its default locale, and glibc (on my box at least) + // returns "en_US.UTF-8". bionic before L returned NULL and in L returns "C.UTF-8", both + // of which get treated as "en_US_POSIX". What that means for this test is that you get + // "INF" for infinity instead of "\u221e". + // On the RI, this test fails for a different reason: their DecimalFormatSymbols.equals + // appears to be broken. It could be that they're accidentally checking the Locale field? checkLocaleIsEquivalentToRoot(new Locale("xx", "XX")); checkLocaleIsEquivalentToRoot(new Locale("not exist language", "not exist country")); } + private void checkLocaleIsEquivalentToRoot(Locale locale) { + DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(locale); + assertEquals(DecimalFormatSymbols.getInstance(Locale.ROOT), dfs); + } // http://code.google.com/p/android/issues/detail?id=14495 public void testSerialization() throws Exception { -- cgit v1.1