dev-java/bsh: enable more tests

Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
Closes: https://github.com/gentoo/gentoo/pull/30398
Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
This commit is contained in:
Volkmar W. Pogatzki 2023-03-29 12:51:58 +02:00 committed by Miroslav Šulc
parent 437974dd35
commit b4c5722ab3
No known key found for this signature in database
GPG Key ID: 65D0F770B26B469C
2 changed files with 151 additions and 33 deletions

View File

@ -40,29 +40,24 @@ DOCS=(
README.md
)
PATCHES=( "${FILESDIR}/bsh-2.1.1-skip-tests.patch" )
JAVA_LAUNCHER_FILENAME="bsh-console"
JAVA_MAIN_CLASS="bsh.Console"
JAVA_RESOURCE_DIRS="resources/src"
JAVA_SRC_DIR=( src bsf/src engine/src )
JAVA_TEST_EXCLUDES=(
bsh.TestUtil # invalid test class
bsh.TestFilter # invalid test class
bsh.Class3_Test
bsh.Class13Test
bsh.Issue_7_Test
bsh.Issue_8_Test
bsh.OldScriptsTest # ?? As the name says Old...
)
JAVA_TEST_GENTOO_CLASSPATH="junit-4"
JAVA_TEST_SRC_DIR="tests/junitTests/src"
JAVA_TEST_SRC_DIR="tests"
src_prepare() {
default
java-pkg-2_src_prepare
java-pkg_clean
java-pkg_clean ! -path "./tests/test-scripts/*"
# These classes are not in upstream jar file
rm engine/src/bsh/TestBshScriptEngine.java || die
rm src/bsh/JThis.java || die
mkdir -p tests/src/bsh/engine || die
mv {engine,tests}/src/bsh/TestBshScriptEngine.java || die
mv {,tests/}src/bsh/JThis.java || die
# java-pkg-simple.eclass wants resources in JAVA_RESOURCE_DIRS
mkdir resources || die
@ -78,26 +73,6 @@ src_prepare() {
! -name 'CodeMap.html' \
! -name 'Manifest.*' \
| xargs cp --parent -t resources || die
# Some but not all tests in these test classes fail
sed \
-e '/import org.junit.Test/a import org.junit.Ignore;' \
-e '/diamond_operator()/i @Ignore' \
-e '/try_with_resource()/i @Ignore' \
-e '/integer_literal_enhancements()/i @Ignore' \
-i tests/junitTests/src/bsh/Project_Coin_Test.java || die
sed \
-e '/import org.junit.Test/a import org.junit.Ignore;' \
-e '/parsing_very_large_hex_literal()/i @Ignore' \
-e '/integer_literal_enhancements_binary()/i @Ignore' \
-e '/parsing_large_hex_literal()/i @Ignore' \
-i tests/junitTests/src/bsh/NumberLiteralTest.java || die
sed \
-e '/import org.junit.Test/a import org.junit.Ignore;' \
-e '/define_interface_with_constants()/i @Ignore' \
-i tests/junitTests/src/bsh/ClassGeneratorTest.java || die
}
src_test() {
@ -106,11 +81,35 @@ src_test() {
# ^
# symbol: class BshScriptEngineFactory
# location: class Issue_55_Test
# cp {engine,tests}/src/bsh/engine/BshScriptEngineFactory.java || die
rm tests/junitTests/src/bsh/Issue_55_Test.java || die
# We add 3 test classes which are not covered by the default test selection of java-pkg-simple
# We skip "OldScriptsTest" and 4 failing test classes.
# Test failures are documeted in bug #903519.
pushd tests/junitTests/src > /dev/null || die
local JAVA_TEST_RUN_ONLY=$(find * \
-type f \
! -name 'OldScriptsTest.java' \
! -name 'Class3_Test.java' \
! -name 'Class13Test.java' \
! -name 'Issue_7_Test.java' \
! -name 'Issue_8_Test.java' \
\( \
-name "*Test.java" \
-o -name "AnnotationsParsing.java" \
-o -name "GoogleReports.java" \
-o -name "Namespace_chaining.java" \
\) )
JAVA_TEST_RUN_ONLY="${JAVA_TEST_RUN_ONLY//.java}"
JAVA_TEST_RUN_ONLY="${JAVA_TEST_RUN_ONLY//\//.}"
popd > /dev/null || die
java-pkg-simple_src_test
}
src_install() {
java-pkg-simple_src_install
# The eclass installs only then main launcher.
java-pkg_dolauncher "${PN}-interpreter" --main bsh.Interpreter
}

View File

@ -0,0 +1,119 @@
Test failures are documeted in https://bugs.gentoo.org/903519
--- a/tests/junitTests/src/bsh/Project_Coin_Test.java
+++ b/tests/junitTests/src/bsh/Project_Coin_Test.java
@@ -26,6 +26,7 @@
package bsh;
import org.junit.Test;
+import org.junit.Ignore;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
@@ -48,6 +49,7 @@ public class Project_Coin_Test {
@Test
@Category(ProjectCoinFeature.class)
+ @Ignore
public void integer_literal_enhancements() throws Exception {
final Interpreter interpreter = new Interpreter();
assertEquals("0x99", 153, interpreter.eval("return 0x99;"));
@@ -61,6 +63,7 @@ public class Project_Coin_Test {
@Test
@Category(ProjectCoinFeature.class)
+ @Ignore
public void diamond_operator() throws Exception {
eval("List<String> list = new ArrayList<>()");
final Object anagrams = eval(
@@ -98,6 +101,7 @@ public class Project_Coin_Test {
@Test
@Category(Project_Coin_Test.class)
+ @Ignore
public void try_with_resource() throws Exception {
final Interpreter interpreter = new Interpreter();
final AtomicBoolean closed = new AtomicBoolean(false);
--- a/tests/junitTests/src/bsh/NumberLiteralTest.java
+++ b/tests/junitTests/src/bsh/NumberLiteralTest.java
@@ -1,6 +1,7 @@
package bsh;
import org.junit.Test;
+import org.junit.Ignore;
import org.junit.runner.RunWith;
import static bsh.TestUtil.eval;
@@ -22,6 +23,7 @@ public class NumberLiteralTest {
}
@Test
+ @Ignore
public void integer_literal_enhancements_binary() throws Exception {
assertEquals("0b10011001", 153, eval("return 0b10011001;"));
}
@@ -49,11 +51,13 @@ public class NumberLiteralTest {
}
@Test
+ @Ignore
public void parsing_large_hex_literal() throws Exception {
assertEquals(0xff000000L, eval("return 0xff000000;"));
}
@Test
+ @Ignore
public void parsing_very_large_hex_literal() throws Exception {
assertEquals(new BigInteger("ff00000000000000", 16), eval("return 0xff00000000000000;"));
}
--- a/tests/junitTests/src/bsh/ClassGeneratorTest.java
+++ b/tests/junitTests/src/bsh/ClassGeneratorTest.java
@@ -27,6 +27,7 @@ package bsh;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.Ignore;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
@@ -86,6 +87,7 @@ public class ClassGeneratorTest {
*/
@Test
@Category(KnownIssue.class)
+ @Ignore
public void define_interface_with_constants() throws Exception {
// these three are treated equal in java
TestUtil.eval("interface Test { public static final int x = 1; }");
--- a/tests/junitTests/src/bsh/GoogleReports.java
+++ b/tests/junitTests/src/bsh/GoogleReports.java
@@ -26,6 +26,7 @@
package bsh;
import org.junit.Test;
+import org.junit.Ignore;
import org.junit.runner.RunWith;
import javax.script.ScriptEngine;
@@ -69,6 +70,7 @@ public class GoogleReports {
* <a href="http://code.google.com/p/beanshell2/issues/detail?id=6">issue#60</a>
*/
@Test
+ @Ignore
public void accessibility_issue_a() throws Exception {
final Interpreter interpreter = new Interpreter();
interpreter.set("x", this);
@@ -83,6 +85,7 @@ public class GoogleReports {
* <a href="http://code.google.com/p/beanshell2/issues/detail?id=6">issue#60</a>
*/
@Test
+ @Ignore
public void accessibility_issue_b() throws Exception {
final Interpreter interpreter = new Interpreter();
interpreter.set("x", this);
@@ -96,6 +99,7 @@ public class GoogleReports {
* <a href="http://code.google.com/p/beanshell2/issues/detail?id=10">issue#10</a>
*/
@Test(expected = ParseException.class)
+ @Ignore
public void parse_error() throws Exception {
eval("\1;");
}