diff --git a/handlebars-caffeine/pom.xml b/handlebars-caffeine/pom.xml index 1c5694a8..a7af93c4 100644 --- a/handlebars-caffeine/pom.xml +++ b/handlebars-caffeine/pom.xml @@ -23,7 +23,7 @@ com.github.ben-manes.caffeine caffeine - 3.1.8 + 3.2.0 diff --git a/handlebars-guava-cache/pom.xml b/handlebars-guava-cache/pom.xml index 85e52821..285b77bd 100644 --- a/handlebars-guava-cache/pom.xml +++ b/handlebars-guava-cache/pom.xml @@ -24,7 +24,7 @@ com.google.guava guava - 33.2.1-jre + 33.4.6-jre @@ -60,7 +60,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.3.0 + 3.5.3 -Duser.language=en -Duser.country=US diff --git a/handlebars-helpers/pom.xml b/handlebars-helpers/pom.xml index 8495db30..dfca854e 100644 --- a/handlebars-helpers/pom.xml +++ b/handlebars-helpers/pom.xml @@ -29,7 +29,7 @@ joda-time joda-time - 2.12.7 + 2.14.0 true diff --git a/handlebars-maven-plugin/pom.xml b/handlebars-maven-plugin/pom.xml index 362b18d3..f219979d 100644 --- a/handlebars-maven-plugin/pom.xml +++ b/handlebars-maven-plugin/pom.xml @@ -35,38 +35,38 @@ org.apache.maven maven-plugin-api - 3.9.8 + 3.9.9 org.apache.maven maven-core - 3.9.8 + 3.9.9 org.apache.maven.plugin-tools maven-plugin-annotations - 3.13.1 + 3.15.1 provided org.codehaus.plexus plexus-utils - 4.0.1 + 4.0.2 org.codehaus.plexus plexus-xml - 4.0.4 + 4.1.0 com.google.javascript closure-compiler - v20240317 + v20250402 @@ -96,7 +96,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.13.1 + 3.15.1 true diff --git a/handlebars/pom.xml b/handlebars/pom.xml index 8e090d9c..541aa7f8 100644 --- a/handlebars/pom.xml +++ b/handlebars/pom.xml @@ -120,7 +120,7 @@ org.apache.felix maven-bundle-plugin - 5.1.9 + 6.0.0 bundle-manifest @@ -202,7 +202,7 @@ org.junit.platform junit-platform-suite - 1.10.3 + 1.12.1 test @@ -227,7 +227,7 @@ commons-io commons-io - 2.16.1 + 2.18.0 test @@ -239,7 +239,7 @@ - 15.4 + 15.6 diff --git a/handlebars/src/test/java/com/github/jknack/handlebars/AbstractTest.java b/handlebars/src/test/java/com/github/jknack/handlebars/AbstractTest.java index 256d3177..3454c8d7 100644 --- a/handlebars/src/test/java/com/github/jknack/handlebars/AbstractTest.java +++ b/handlebars/src/test/java/com/github/jknack/handlebars/AbstractTest.java @@ -34,6 +34,19 @@ public void shouldCompileTo(final String template, final String data, final Stri shouldCompileTo(template, data, expected, ""); } + /** + * Normalizes spaces in the result and compares it with the expected value. + * + * @param template The template to compile. + * @param data The context to apply. + * @param expected The expected result. + * @throws IOException If an I/O error occurs. + */ + public void shouldCompileToNormalized(final String template, final Object data, final String expected) + throws IOException { + shouldCompileToNormalized(template, data, new Hash(), new Hash(), expected, ""); + } + public void shouldCompileTo(final String template, final Object data, final String expected) throws IOException { shouldCompileTo(template, data, expected, ""); @@ -120,6 +133,41 @@ public void shouldCompileTo( assertEquals(expected, result, "'" + expected + "' should === '" + result + "': " + message); } + /* + * Normalizes spaces in the result and compares it with the expected value. + * + * @param template The template to compile. + * @param context The context to apply. + * @param helpers The helpers to use. + * @param partials The partials to use. + * @param expected The expected result. + * @param message The message to display on failure. + * @throws IOException If an I/O error occurs. + */ + public void shouldCompileToNormalized( + final String template, + final Object context, + final Hash helpers, + final Hash partials, + final String expected, + final String message) + throws IOException { + Template t = compile(template, helpers, partials); + String result = t.apply(configureContext(context)); + assertEquals(expected, normalizeSpaces(result), "'" + expected + "' should === '" + result + "': " + message); + } + + /** + * Helper to normalize narrow no-break space (U+202F) and regular non-breaking space (U+00A0) + * characters to regular space (U+0020). + */ + public String normalizeSpaces(String input) { + return input.replace('\u202F', ' ') + .replace('\u00A0', ' ') + .replaceAll("\\s+", " ") // optional: also collapses multiple spaces + .trim(); + } + protected Object configureContext(final Object context) { return context; } diff --git a/pom.xml b/pom.xml index 67461589..465a9677 100644 --- a/pom.xml +++ b/pom.xml @@ -64,13 +64,13 @@ org.apache.commons commons-lang3 - 3.14.0 + 3.17.0 org.apache.commons commons-text - 1.12.0 + 1.13.0 @@ -89,7 +89,7 @@ org.slf4j slf4j-api - 2.0.13 + 2.0.17 @@ -111,7 +111,7 @@ ch.qos.logback logback-classic - 1.5.6 + 1.5.18 @@ -135,13 +135,13 @@ org.yaml snakeyaml - 2.2 + 2.4 org.hamcrest hamcrest - 2.2 + 3.0 @@ -156,7 +156,7 @@ maven-compiler-plugin - 3.13.0 + 3.14.0 @@ -168,7 +168,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.7.0 + 3.11.2 com.github.jknack.handlebars.internal.* public @@ -189,7 +189,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.3.0 + 3.5.3 -Duser.language=en -Duser.country=US @@ -214,7 +214,7 @@ com.diffplug.spotless spotless-maven-plugin - 2.43.0 + 2.44.4 true @@ -260,7 +260,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.3.0 + 3.5.3 false @@ -290,7 +290,7 @@ org.codehaus.mojo exec-maven-plugin - 3.3.0 + 3.5.0 initialize @@ -393,7 +393,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.2.4 + 3.2.7 sign-artifacts @@ -494,20 +494,20 @@ UTF-8 - 2.17.1 - 6.1.10 - 0.8.12 - 4.13.1 - 5.12.0 + 2.18.3 + 6.2.5 + 0.8.13 + 4.13.2 + 5.17.0 yyyy-MM-dd HH:mm:ssa 3.1.0 ${maven.build.timestamp} - 17 - 17 - 17 + 21 + 21 + 21 false src${file.separator}etc${file.separator}formatter.sh handlebars${file.separator}src${file.separator}test${file.separator}resources${file.separator}mustache - 5.10.3 + 5.12.1 diff --git a/tests/pom.xml b/tests/pom.xml index 98ba8782..59d1589a 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -33,7 +33,7 @@ joda-time joda-time - 2.12.7 + 2.14.0 @@ -75,7 +75,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.3.0 + 3.5.3 -Duser.language=en -Duser.country=US @@ -95,7 +95,7 @@ org.apache.maven.plugins maven-deploy-plugin - 3.1.2 + 3.1.4 true diff --git a/tests/src/test/java/com/github/jknack/handlebars/helper/ext/JodaHelperTest.java b/tests/src/test/java/com/github/jknack/handlebars/helper/ext/JodaHelperTest.java index 756ced4c..46dda35e 100644 --- a/tests/src/test/java/com/github/jknack/handlebars/helper/ext/JodaHelperTest.java +++ b/tests/src/test/java/com/github/jknack/handlebars/helper/ext/JodaHelperTest.java @@ -60,8 +60,11 @@ public void testStyle() throws IOException { version -> version <= 8, () -> shouldCompileTo("{{jodaStyleHelper this \"SS\"}}", dateTime, "7/4/95 2:32 PM")); withJava( - version -> version >= 9, + version -> version >= 9 && version <= 20, () -> shouldCompileTo("{{jodaStyleHelper this \"SS\"}}", dateTime, "7/4/95, 2:32 PM")); + withJava( + version -> version >= 21, + () -> shouldCompileToNormalized("{{jodaStyleHelper this \"SS\"}}", dateTime, "7/4/95, 2:32 PM")); } @Test