From 01bdfb04c2aa22560130e5cfea9148371ac65d32 Mon Sep 17 00:00:00 2001 From: btangmu Date: Mon, 8 Jan 2024 16:12:28 -0500 Subject: [PATCH 1/2] CLDR-17088 Flesh out en.xml; new test for null/blank/inheritance-marker -New TestEnInheritance.java --- .../unicode/cldr/test/TestEnInheritance.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tools/cldr-code/src/test/java/org/unicode/cldr/test/TestEnInheritance.java diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/test/TestEnInheritance.java b/tools/cldr-code/src/test/java/org/unicode/cldr/test/TestEnInheritance.java new file mode 100644 index 00000000000..b8588d04646 --- /dev/null +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/test/TestEnInheritance.java @@ -0,0 +1,46 @@ +package org.unicode.cldr.test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.logging.Logger; +import org.junit.jupiter.api.Test; +import org.unicode.cldr.util.*; + +/** + * Check modern coverage inherited values in en that are marked with up arrows or are blank; all + * values should be explicit in en + */ +public class TestEnInheritance { + private static final Logger logger = Logger.getLogger(TestEnInheritance.class.getName()); + + private static final String LOCALE_ID = "en"; + + @Test + void testEn() { + final CLDRConfig config = CLDRConfig.getInstance(); + final CLDRFile cldrFile = config.getCLDRFile(LOCALE_ID, true); + final SupplementalDataInfo sdi = SupplementalDataInfo.getInstance(); + final CoverageLevel2 coverageLevel = CoverageLevel2.getInstance(sdi, LOCALE_ID); + int pathsWithNullValue = 0, pathsWithBlankValue = 0, pathsWithMarkerValue = 0; + for (final String path : cldrFile.fullIterable()) { + if (coverageLevel.getLevel(path).getLevel() <= Level.MODERN.getLevel()) { + String value = cldrFile.getStringValue(path); + if (value == null) { + complain("null value", ++pathsWithNullValue, path); + } else if (value.isBlank()) { + complain("blank value", ++pathsWithBlankValue, path); + } else if (CldrUtility.INHERITANCE_MARKER.equals(value)) { + complain("inheritance marker", ++pathsWithMarkerValue, path); + } + } + } + assertEquals(0, pathsWithNullValue, "null values"); + assertEquals(0, pathsWithBlankValue, "blank values"); + assertEquals(0, pathsWithMarkerValue, "inheritance marker values"); + } + + private void complain(String description, int count, String path) { + logger.severe( + this.getClass().getSimpleName() + " -- " + description + " " + count + " " + path); + } +} From d95d4d2ce5fead66be76541b5fb9d7f33f04ee23 Mon Sep 17 00:00:00 2001 From: btangmu Date: Mon, 8 Jan 2024 16:32:06 -0500 Subject: [PATCH 2/2] CLDR-17088 Flesh out en.xml; new test for null/blank/inheritance-marker -New TestEnInheritance.java -Use non-resolving CLDRFile -Allow blank for foreignSpaceReplacement, nativeSpaceReplacement --- .../test/java/org/unicode/cldr/test/TestEnInheritance.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/test/TestEnInheritance.java b/tools/cldr-code/src/test/java/org/unicode/cldr/test/TestEnInheritance.java index b8588d04646..972aac185e8 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/test/TestEnInheritance.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/test/TestEnInheritance.java @@ -18,7 +18,7 @@ public class TestEnInheritance { @Test void testEn() { final CLDRConfig config = CLDRConfig.getInstance(); - final CLDRFile cldrFile = config.getCLDRFile(LOCALE_ID, true); + final CLDRFile cldrFile = config.getCLDRFile(LOCALE_ID, false); final SupplementalDataInfo sdi = SupplementalDataInfo.getInstance(); final CoverageLevel2 coverageLevel = CoverageLevel2.getInstance(sdi, LOCALE_ID); int pathsWithNullValue = 0, pathsWithBlankValue = 0, pathsWithMarkerValue = 0; @@ -27,7 +27,9 @@ void testEn() { String value = cldrFile.getStringValue(path); if (value == null) { complain("null value", ++pathsWithNullValue, path); - } else if (value.isBlank()) { + } else if (value.isBlank() + && !DisplayAndInputProcessor.FSR_START_PATH.equals(path) + && !DisplayAndInputProcessor.NSR_START_PATH.equals(path)) { complain("blank value", ++pathsWithBlankValue, path); } else if (CldrUtility.INHERITANCE_MARKER.equals(value)) { complain("inheritance marker", ++pathsWithMarkerValue, path);