Switched back to Kokoro's dynamic pool, as the catalina pool image only has Java 14 installed (!?). Added Catalina check for the two tests that require it for native i18n fixes.
@@ -61,6 +61,7 @@ public class DecimalFormatTest extends junit.framework.TestCase {
// Regression test for http://b/1897917: BigDecimal does not take into account multiplier.
public void testBigDecimalBug1897917() {
+ if (onCatalinaOrAbove()) { // j2objc: i18n bug fixed in MacOS Catalina.
// For example. the BigDecimal 0.17 formatted in PercentInstance is 0% instead of 17%:
NumberFormat pf = NumberFormat.getPercentInstance();
assertEquals("17%", pf.format(BigDecimal.valueOf(0.17)));
@@ -86,6 +87,7 @@ public class DecimalFormatTest extends junit.framework.TestCase {
assertDecFmtWithMultiplierAndFractionByLocale("3330000000000000000000000000000000", 3, 4,
en_IN, "9,99,00,00,00,00,00,00,00,00,00,00,00,00,00,00,000");
}
+ }
public void testBigDecimalTestBigIntWithMultiplier() {
// Big integer tests.
@@ -176,6 +178,7 @@ public class DecimalFormatTest extends junit.framework.TestCase {
}
public void testSetZeroDigitForPattern() {
+ if (onCatalinaOrAbove()) { // j2objc: i18n bug fixed in MacOS Catalina.
DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols();
decimalFormatSymbols.setZeroDigit('a');
DecimalFormat formatter = new DecimalFormat();
@@ -183,6 +186,7 @@ public class DecimalFormatTest extends junit.framework.TestCase {
formatter.applyLocalizedPattern("#.aa");
assertEquals("e.fa", formatter.format(4.50));
}
+ }
public void testSetZeroDigitForFormatting() {
DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols();
@@ -346,4 +350,13 @@ public class DecimalFormatTest extends junit.framework.TestCase {
localeCurrencyFormat.setCurrency(currency);
return localeCurrencyFormat.format(1000);
}
+
+ // j2objc: returns true if test is running on a MacOS Catalina or later operating system.
+ protected boolean onCatalinaOrAbove() {
+ String[] versionFields = System.getProperty("os.version").split("\\.", -1);
+ // MacOS Catalina is version 10.15.*.
+ return
+ (Integer.parseInt(versionFields[0]) == 10 && Integer.parseInt(versionFields[1]) >= 15)
+ || Integer.parseInt(versionFields[0]) >= 11;
+ }
}
