--- old/test/java/lang/String/ToLowerCase.java 2015-10-30 14:04:01.879265890 -0700 +++ new/test/java/lang/String/ToLowerCase.java 2015-10-30 14:04:01.623266859 -0700 @@ -23,7 +23,7 @@ /* @test - @bug 4217441 4533872 4900935 8020037 8032012 8041791 8042589 + @bug 4217441 4533872 4900935 8020037 8032012 8041791 8042589 8054307 @summary toLowerCase should lower-case Greek Sigma correctly depending on the context (final/non-final). Also it should handle Locale specific (lt, tr, and az) lowercasings and supplementary @@ -134,14 +134,60 @@ } test(src.toString(), Locale.US, exp.toString()); + // test latin1 + src = new StringBuilder(0x100); + exp = new StringBuilder(0x100); + for (int cp = 0; cp < 0x100; cp++) { + int lowerCase = Character.toLowerCase(cp); + if (lowerCase == -1) { //Character.ERROR + continue; + } + src.appendCodePoint(cp); + exp.appendCodePoint(lowerCase); + } + test(src.toString(), Locale.US, exp.toString()); + + // test non-latin1 -> latin1 + src = new StringBuilder(0x100).append("abc"); + exp = new StringBuilder(0x100).append("abc"); + for (int cp = 0x100; cp < 0x10000; cp++) { + int lowerCase = Character.toLowerCase(cp); + if (lowerCase < 0x100 && cp != '\u0130') { + src.appendCodePoint(cp); + exp.appendCodePoint(lowerCase); + } + } + test(src.toString(), Locale.US, exp.toString()); } static void test(String in, Locale locale, String expected) { + test0(in, locale,expected); + for (String[] ss : new String[][] { + new String[] {"abc", "abc"}, + new String[] {"aBc", "abc"}, + new String[] {"ABC", "abc"}, + new String[] {"ab\u4e00", "ab\u4e00"}, + new String[] {"aB\u4e00", "ab\u4e00"}, + new String[] {"AB\u4e00", "ab\u4e00"}, + new String[] {"ab\uD800\uDC00", "ab\uD800\uDC00"}, + new String[] {"aB\uD800\uDC00", "ab\uD800\uDC00"}, + new String[] {"AB\uD800\uDC00", "ab\uD800\uDC00"}, + new String[] {"ab\uD801\uDC1C", "ab\uD801\uDC44"}, + new String[] {"aB\uD801\uDC1C", "ab\uD801\uDC44"}, + new String[] {"AB\uD801\uDC1C", "ab\uD801\uDC44"}, + + }) { + test0(ss[0] + " " + in, locale, ss[1] + " " + expected); + test0(in + " " + ss[0], locale, expected + " " + ss[1]); + } + } + + static void test0(String in, Locale locale, String expected) { String result = in.toLowerCase(locale); if (!result.equals(expected)) { System.err.println("input: " + in + ", locale: " + locale + ", expected: " + expected + ", actual: " + result); throw new RuntimeException(); } - } + } }