From 2419e959eba7ba4945452325216df3ce7c0b1bf7 Mon Sep 17 00:00:00 2001 From: Miroslav Šulc Date: Sat, 29 May 2021 17:58:15 +0200 Subject: dev-java/strimgtemplate: fixed tests in 4.0.8-r1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: https://bugs.gentoo.org/791718 Package-Manager: Portage-3.0.19, Repoman-3.0.3 Signed-off-by: Miroslav Šulc --- .../files/stringtemplate-4.0.8-fix-tests.patch | 72 ++++++++++++++++++++++ .../stringtemplate/stringtemplate-4.0.8-r1.ebuild | 1 + 2 files changed, 73 insertions(+) create mode 100644 dev-java/stringtemplate/files/stringtemplate-4.0.8-fix-tests.patch (limited to 'dev-java') diff --git a/dev-java/stringtemplate/files/stringtemplate-4.0.8-fix-tests.patch b/dev-java/stringtemplate/files/stringtemplate-4.0.8-fix-tests.patch new file mode 100644 index 000000000000..994fd42ad5e6 --- /dev/null +++ b/dev-java/stringtemplate/files/stringtemplate-4.0.8-fix-tests.patch @@ -0,0 +1,72 @@ +From 3ea94a870b6e139399abbf932da1dfa2f9bd37e3 Mon Sep 17 00:00:00 2001 +From: parrt +Date: Thu, 8 Nov 2018 11:40:24 -0800 +Subject: [PATCH] make tests work with java 10 and 6, 7, 8 + +--- + .../stringtemplate/v4/test/TestRenderers.java | 24 +++++++++++++++---- + 1 file changed, 20 insertions(+), 4 deletions(-) + +diff --git a/test/org/stringtemplate/v4/test/TestRenderers.java b/test/org/stringtemplate/v4/test/TestRenderers.java +index bc5406f7..7b7536e0 100644 +--- a/test/org/stringtemplate/v4/test/TestRenderers.java ++++ b/test/org/stringtemplate/v4/test/TestRenderers.java +@@ -48,6 +48,8 @@ + + public class TestRenderers extends BaseTest { + ++ String javaVersion = System.getProperty("java.version"); ++ + // Make sure to use the US Locale during the tests + private Locale origLocale; + +@@ -73,6 +75,9 @@ public void tearDown() { + ST st = group.getInstanceOf("dateThing"); + st.add("created", new GregorianCalendar(2005, 7 - 1, 5)); + String expecting = "datetime: 7/5/05, 12:00 AM"; ++ if ( javaVersion.startsWith("1.6") || javaVersion.startsWith("1.7") || javaVersion.startsWith("1.8") ) { ++ expecting = "datetime: 7/5/05 12:00 AM"; ++ } + String result = st.render(); + assertEquals(expecting, result); + } +@@ -99,7 +104,10 @@ public void tearDown() { + ST st = group.getInstanceOf("dateThing"); + st.add("created", new GregorianCalendar(2005, 7 - 1, 5)); + String expecting = " datetime: 7/5/05, 12:00 AM "; +- String result = st.render(); ++ if ( javaVersion.startsWith("1.6") || javaVersion.startsWith("1.7") || javaVersion.startsWith("1.8") ) { ++ expecting = " datetime: 7/5/05 12:00 AM "; ++ } ++ String result = st.render(); + assertEquals(expecting, result); + } + +@@ -116,9 +124,13 @@ public void tearDown() { + TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles")); + st.add("created", new GregorianCalendar(2005, 7 - 1, 5)); + String expecting = " datetime: Tuesday, July 5, 2005 at 12:00:00 AM Pacific Daylight Time "; +- String result = st.render(); ++ if ( javaVersion.startsWith("1.6") || javaVersion.startsWith("1.7") || javaVersion.startsWith("1.8") ) { ++ expecting = " datetime: Tuesday, July 5, 2005 12:00:00 AM PDT "; ++ } ++ String result = st.render(); + assertEquals(expecting, result); +- } finally { ++ } ++ finally { + // Restore original Timezone + TimeZone.setDefault(origTimeZone); + } +@@ -371,6 +383,10 @@ public void tearDown() { + cal.set(2012, Calendar.JUNE, 12); + st.add("date", cal); + +- assertEquals("12 de junho de 2012", st.render(new Locale("pt"))); ++ String expected = "12 de junho de 2012"; ++ if ( javaVersion.startsWith("1.6") || javaVersion.startsWith("1.7") || javaVersion.startsWith("1.8") ) { ++ expected = "12 de Junho de 2012"; ++ } ++ assertEquals(expected, st.render(new Locale("pt"))); + } + } diff --git a/dev-java/stringtemplate/stringtemplate-4.0.8-r1.ebuild b/dev-java/stringtemplate/stringtemplate-4.0.8-r1.ebuild index c2fba7061b02..72831a73fdbb 100644 --- a/dev-java/stringtemplate/stringtemplate-4.0.8-r1.ebuild +++ b/dev-java/stringtemplate/stringtemplate-4.0.8-r1.ebuild @@ -37,6 +37,7 @@ JAVA_SRC_DIR="src" PATCHES=( # These tests are broken but are probably fixed in current master. "${FILESDIR}/4.0.8-r1-test-fixes.patch" + "${FILESDIR}/${P}-fix-tests.patch" ) src_unpack() { -- cgit v1.2.3-65-gdbad