From 14c05954b0b334fc30003c9eedaddd21de1d2f63 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Thu, 18 Mar 2021 10:30:33 +0300 Subject: [PATCH] html4j: fix and unignore tests --- .../teavm/html4j/test/JavaScriptBodyConversionTest.java | 6 ++---- .../java/org/teavm/html4j/test/JavaScriptBodyTest.java | 8 ++++---- .../org/teavm/html4j/test/JavaScriptTCKCheckTest.java | 9 ++++++--- .../java/org/teavm/html4j/test/JavaScriptTCKTest.java | 2 -- .../test/java/org/teavm/html4j/test/KnockoutFXTest.java | 4 ---- .../java/org/teavm/html4j/test/KnockoutTCKCheckTest.java | 9 ++++++--- .../test/java/org/teavm/html4j/test/KnockoutTCKTest.java | 3 --- 7 files changed, 18 insertions(+), 23 deletions(-) diff --git a/html4j/src/test/java/org/teavm/html4j/test/JavaScriptBodyConversionTest.java b/html4j/src/test/java/org/teavm/html4j/test/JavaScriptBodyConversionTest.java index 4c9785906..337bee801 100644 --- a/html4j/src/test/java/org/teavm/html4j/test/JavaScriptBodyConversionTest.java +++ b/html4j/src/test/java/org/teavm/html4j/test/JavaScriptBodyConversionTest.java @@ -17,7 +17,6 @@ package org.teavm.html4j.test; import static org.junit.Assert.*; import net.java.html.js.JavaScriptBody; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.teavm.junit.SkipJVM; @@ -25,7 +24,6 @@ import org.teavm.junit.TeaVMTestRunner; @RunWith(TeaVMTestRunner.class) @SkipJVM -@Ignore public class JavaScriptBodyConversionTest { @Test public void convertsInteger() { @@ -60,9 +58,9 @@ public class JavaScriptBodyConversionTest { @Test public void copiesArray() { Integer[] array = { 23, 42 }; - Integer[] arrayCopy = (Integer[]) modifyIntegerArray(array); + Object[] arrayCopy = (Object[]) modifyIntegerArray(array); assertEquals(Integer.valueOf(23), array[0]); - assertEquals(Integer.valueOf(1), arrayCopy[0]); + assertEquals(1, arrayCopy[0]); } @Test diff --git a/html4j/src/test/java/org/teavm/html4j/test/JavaScriptBodyTest.java b/html4j/src/test/java/org/teavm/html4j/test/JavaScriptBodyTest.java index d00ea90d7..b1f4683ac 100644 --- a/html4j/src/test/java/org/teavm/html4j/test/JavaScriptBodyTest.java +++ b/html4j/src/test/java/org/teavm/html4j/test/JavaScriptBodyTest.java @@ -17,12 +17,12 @@ package org.teavm.html4j.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import net.java.html.js.JavaScriptBody; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.teavm.junit.SkipJVM; @@ -30,7 +30,6 @@ import org.teavm.junit.TeaVMTestRunner; @RunWith(TeaVMTestRunner.class) @SkipJVM -@Ignore public class JavaScriptBodyTest { @Test public void readResource() throws IOException { @@ -63,8 +62,9 @@ public class JavaScriptBodyTest { @Test public void dependencyPropagatedThroughArray() { storeObject(new Object[] { new AImpl() }); - A[] array = (A[]) retrieveObject(); - assertEquals(23, array[0].foo()); + Object[] array = (Object[]) retrieveObject(); + assertTrue(array[0] instanceof A); + assertEquals(23, ((A) array[0]).foo()); } @Test diff --git a/html4j/src/test/java/org/teavm/html4j/test/JavaScriptTCKCheckTest.java b/html4j/src/test/java/org/teavm/html4j/test/JavaScriptTCKCheckTest.java index a57c154d5..cbf6032ce 100644 --- a/html4j/src/test/java/org/teavm/html4j/test/JavaScriptTCKCheckTest.java +++ b/html4j/src/test/java/org/teavm/html4j/test/JavaScriptTCKCheckTest.java @@ -18,19 +18,22 @@ package org.teavm.html4j.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java.lang.reflect.Method; -import org.junit.Ignore; import org.junit.Test; +import org.junit.runner.RunWith; import org.netbeans.html.json.tck.JavaScriptTCK; import org.netbeans.html.json.tck.KOTest; +import org.teavm.junit.SkipJVM; +import org.teavm.junit.TeaVMTestRunner; /** * * @author Jaroslav Tulach */ -@Ignore +@RunWith(TeaVMTestRunner.class) +@SkipJVM public class JavaScriptTCKCheckTest extends JavaScriptTCK { @Test - public void allJavaScriptBodyTestMethodsOverriden() throws Exception { + public void allJavaScriptBodyTestMethodsOverridden() throws Exception { for (Class c : testClasses()) { if (c.getName().contains("GC")) { continue; diff --git a/html4j/src/test/java/org/teavm/html4j/test/JavaScriptTCKTest.java b/html4j/src/test/java/org/teavm/html4j/test/JavaScriptTCKTest.java index 95dbda02a..67684b94f 100644 --- a/html4j/src/test/java/org/teavm/html4j/test/JavaScriptTCKTest.java +++ b/html4j/src/test/java/org/teavm/html4j/test/JavaScriptTCKTest.java @@ -16,7 +16,6 @@ package org.teavm.html4j.test; import net.java.html.js.tests.JavaScriptBodyTest; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.teavm.junit.SkipJVM; @@ -28,7 +27,6 @@ import org.teavm.junit.TeaVMTestRunner; */ @RunWith(TeaVMTestRunner.class) @SkipJVM -@Ignore public class JavaScriptTCKTest extends JavaScriptBodyTest { @Test @Override diff --git a/html4j/src/test/java/org/teavm/html4j/test/KnockoutFXTest.java b/html4j/src/test/java/org/teavm/html4j/test/KnockoutFXTest.java index d3f8f83d4..8e86d4224 100644 --- a/html4j/src/test/java/org/teavm/html4j/test/KnockoutFXTest.java +++ b/html4j/src/test/java/org/teavm/html4j/test/KnockoutFXTest.java @@ -24,7 +24,6 @@ import java.util.HashMap; import java.util.Map; import net.java.html.BrwsrCtx; import net.java.html.js.JavaScriptBody; -import org.junit.Ignore; import org.netbeans.html.context.spi.Contexts; import org.netbeans.html.json.spi.JSONCall; import org.netbeans.html.json.spi.Technology; @@ -38,14 +37,11 @@ import org.teavm.jso.JSObject; import org.teavm.jso.browser.Window; import org.teavm.jso.dom.html.HTMLDocument; import org.teavm.jso.dom.html.HTMLElement; -import org.teavm.junit.WholeClassCompilation; /** * * @author Jaroslav Tulach */ -@WholeClassCompilation -@Ignore public final class KnockoutFXTest extends KnockoutTCK implements Transfer, WSTransfer { private KO4J ko4j = new KO4J(); private final Map urlMap = new HashMap<>(); diff --git a/html4j/src/test/java/org/teavm/html4j/test/KnockoutTCKCheckTest.java b/html4j/src/test/java/org/teavm/html4j/test/KnockoutTCKCheckTest.java index 53fde41ef..088a9de0c 100644 --- a/html4j/src/test/java/org/teavm/html4j/test/KnockoutTCKCheckTest.java +++ b/html4j/src/test/java/org/teavm/html4j/test/KnockoutTCKCheckTest.java @@ -19,18 +19,21 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; import java.lang.reflect.Method; -import org.junit.Ignore; import org.junit.Test; +import org.junit.runner.RunWith; import org.netbeans.html.json.tck.KOTest; +import org.teavm.junit.SkipJVM; +import org.teavm.junit.TeaVMTestRunner; /** * * @author Jaroslav Tulach */ -@Ignore +@RunWith(TeaVMTestRunner.class) +@SkipJVM public class KnockoutTCKCheckTest { @Test - public void allKnockoutTestMethodsOverriden() throws Exception { + public void allKnockoutTestMethodsOverridden() { for (Class c : KnockoutFXTest.allTestClasses()) { if (c.getName().contains("GC")) { continue; diff --git a/html4j/src/test/java/org/teavm/html4j/test/KnockoutTCKTest.java b/html4j/src/test/java/org/teavm/html4j/test/KnockoutTCKTest.java index 89dcb3347..cad0eeeec 100644 --- a/html4j/src/test/java/org/teavm/html4j/test/KnockoutTCKTest.java +++ b/html4j/src/test/java/org/teavm/html4j/test/KnockoutTCKTest.java @@ -21,7 +21,6 @@ import net.java.html.json.tests.KnockoutTest; import net.java.html.json.tests.MinesTest; import net.java.html.json.tests.OperationsTest; import net.java.html.json.tests.WebSocketTest; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.teavm.junit.SkipJVM; @@ -35,8 +34,6 @@ import org.teavm.junit.WholeClassCompilation; @RunWith(TeaVMTestRunner.class) @SkipJVM @WholeClassCompilation -@Ignore -// TODO: fix JavaScriptBody implementation and unignore public class KnockoutTCKTest { private final ConvertTypesTest convertTypesTest = new ConvertTypesTest(); private final JSONTest jsonTest = new JSONTest();