/* * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/
/* * @test * @bug 4397357 6565620 6959267 7070436 7198195 8041791 8032446 8072600 * 8221431 * @summary Confirm special case mappings are handled correctly. * @library /lib/testlibrary/java/lang
*/
// Locales which are used for testing privatestatic List<Locale> locales = new ArrayList<>(); static {
locales.add(Locale.of("az"));
locales.addAll(java.util.Arrays.asList(Locale.getAvailableLocales()));
}
// True if the default language is az, lt, or tr which has locale-specific // mappings. privatestaticboolean specificLocale;
// Additional test cases // Pseudo-locales which are used here: // L1: locales other than lt // L2: locales other than az and tr // L3: locales other than az, lt and tr privatestaticfinal String[] additionalTestData = { // Format: // <code>; <lower>; <title>; <upper>; (<condition_list>)
// Counterpart of Final_Sigma test case // 03A3; 03C2; 03A3; 03A3; Final_Sigma "03A3; 03C3; 03A3; 03A3; SunSpecific_Not_Final_Sigma1", "03A3; 03C3; 03A3; 03A3; SunSpecific_Not_Final_Sigma2",
for (int i = 0; i < 4; i++) { if (fields[i].length() != 0) {
fields[i] = convert(fields[i]);
}
} if (fields.length != 4) {
StringTokenizer st = new StringTokenizer(fields[4]);
while (st.hasMoreTokens()) {
String token = st.nextToken();
if (lang.equals("L1")) { if (defaultLang.equals("lt")) {
lang = "en";
} else {
lang = defaultLang;
}
} elseif (lang.equals("L2")) { if (defaultLang.equals("az") ||
defaultLang.equals("tr")) {
lang = "en";
} else {
lang = defaultLang;
}
} elseif (lang.equals("L3")) { if (defaultLang.equals("az") ||
defaultLang.equals("lt") ||
defaultLang.equals("tr")) {
lang = "en";
} else {
lang = defaultLang;
} // I want to have another test case here for double-check. // Current implementation for Character and String considers // only az, lt, and tr locales. I want to detect if other // locales are specified.
} elseif (!lang.equals("az") &&
!lang.equals("lt") &&
!lang.equals("tr")) { thrownew RuntimeException("Unsupported locale: " +
lang + ". It may need to be considered in ConditionalSpecialCasing.java. Please confirm.");
}
} else { thrownew RuntimeException("Unknown condition: " + token);
}
}
} elseif (fields[0].equals("\u0130")) { // special case for \u0130 if (defaultLang.equals("az") ||
defaultLang.equals("tr")) {
lang = "en";
} else {
lang = defaultLang;
}
}
testLowerCase(fields[0], fields[1], lang, condition);
testUpperCase(fields[0], fields[3], lang, condition);
}
int len = str.length(); for (int i = 0; i < len; i++) {
sb.append("0x").append(Integer.toHexString(str.charAt(i)).toUpperCase()).append(" ");
} return sb.toString();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.