This is an automated email from the ASF dual-hosted git repository.

ddekany pushed a commit to branch FREEMARKER-35
in repository https://gitbox.apache.org/repos/asf/freemarker.git


The following commit(s) were added to refs/heads/FREEMARKER-35 by this push:
     new 944bca3  [FREEMARKER-35] Trying to figure out localization related 
test failure on Travis. Attempt 2.
944bca3 is described below

commit 944bca3b6ddd0b46d8bc96112e282983e4434f6f
Author: ddekany <[email protected]>
AuthorDate: Tue Dec 28 12:12:55 2021 +0100

    [FREEMARKER-35] Trying to figure out localization related test failure on 
Travis. Attempt 2.
---
 .../template/utility/DateUtilsPatternParsingTest.java       | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git 
a/src/test/java/freemarker/template/utility/DateUtilsPatternParsingTest.java 
b/src/test/java/freemarker/template/utility/DateUtilsPatternParsingTest.java
index b92bea4..41021d0 100644
--- a/src/test/java/freemarker/template/utility/DateUtilsPatternParsingTest.java
+++ b/src/test/java/freemarker/template/utility/DateUtilsPatternParsingTest.java
@@ -29,7 +29,10 @@ import java.time.ZoneId;
 import java.time.ZoneOffset;
 import java.time.ZonedDateTime;
 import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
 import java.time.format.DateTimeParseException;
+import java.time.format.TextStyle;
+import java.time.temporal.ChronoField;
 import java.time.temporal.Temporal;
 import java.util.Date;
 import java.util.List;
@@ -76,18 +79,24 @@ public class DateUtilsPatternParsingTest {
                 Locale.GERMAN,
                 new Locale("hi", "IN"),
                 Locale.JAPANESE,
+                Locale.ROOT,
                 new Locale("ru", "RU"),
                 Locale.US,
                 new Locale("th", "TH") // Uses buddhist calendar
         ).stream()
-                .filter(locale -> !DateTimeFormatter.ofPattern("MMM", 
locale).format(localDate).equals("12"))
+                .filter(locale -> !(
+                        new DateTimeFormatterBuilder()
+                                .appendText(ChronoField.MONTH_OF_YEAR, 
TextStyle.SHORT_STANDALONE)
+                                .toFormatter(locale)
+                                .format(localDate))
+                        .equals("12"))
                 .collect(Collectors.toList());
         System.out.println("!!T Sample locales: " + SAMPLE_LOCALES); // TODO 
Remove this
     }
 
     @Test
     public void testHasEnoughSampleLocales() {
-        if (SAMPLE_LOCALES.size() < 3) {
+        if (SAMPLE_LOCALES.size() < 4) {
             throw new AssertionError("Too many locales were filtered out from 
SAMPLE_LOCALE. " +
                     "We only have these left: " + SAMPLE_LOCALES);
         }

Reply via email to