Skip to content

Commit

Permalink
CLDR-17726 make TestTransform.TestLocales less obscure
Browse files Browse the repository at this point in the history
- this test is sensitive to the current CLDR locales at modern.
- change the test so that it reports *which* locales are causing the need for chars in the transforms.
  • Loading branch information
srl295 committed Jun 12, 2024
1 parent dad9f09 commit 6f451b6
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.unicode.cldr.draft.FileUtilities;
import org.unicode.cldr.tool.LikelySubtags;
import org.unicode.cldr.util.CLDRConfig;
Expand Down Expand Up @@ -860,6 +861,8 @@ public void TestLocales() {
CLDRTransforms.getInstance().registerModified();
}

Set<Pair<String, String>> badLocaleScript = new TreeSet<>();

for (String locale : modernCldr) {
if (special.contains(locale)) {
continue;
Expand Down Expand Up @@ -900,6 +903,7 @@ public void TestLocales() {
+ " code points:\n"
+ badPlusSample);
allMissing.addAll(badPlusSample);
badLocaleScript.add(Pair.of(locale, script));
}
}
if (!allMissing.isEmpty()) {
Expand All @@ -924,6 +928,11 @@ public void TestLocales() {
+ allMissing.dataSet.keySet());
for (String script : allMissing.scriptMissing.values()) {
UnicodeSet missingFoScript = allMissing.scriptMissing.getKeys(script);
String localeForScript =
badLocaleScript.stream()
.filter(p -> p.getSecond().equals((script)))
.map(p -> p.getFirst())
.collect(Collectors.joining(","));
errln(

Check failure on line 936 in tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestTransforms.java

View workflow job for this annotation

GitHub Actions / build

(TestTransforms.java:936) Error: Transliterator for Cyrl missing 4: [ҲҳҶҷ]=[\u04B2\u04B3\u04B6\u04B7] - needed for locales: tg
"Transliterator for\t"
+ script
Expand All @@ -932,7 +941,9 @@ public void TestLocales() {
+ ":\t"
+ missingFoScript.toPattern(false)
+ "="
+ missingFoScript);
+ missingFoScript
+ " - needed for locales: "
+ localeForScript);
}
}
}
Expand Down

0 comments on commit 6f451b6

Please sign in to comment.