mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Add a test for an issue which I believe is caused by failure to identify
an asynchronous method. Unfortunately I am unable to actually produce a failing test; instead an exception message is generated during test execution. This seems to be an issue with the test runner mechanism.
This commit is contained in:
parent
651532c203
commit
95f07d80a7
|
@ -167,6 +167,13 @@ public class VMTest {
|
||||||
assertEquals("ok", acl.instanceState);
|
assertEquals("ok", acl.instanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void asyncWait() {
|
||||||
|
AsyncClinitClass acl = new AsyncClinitClass();
|
||||||
|
acl.doWait();
|
||||||
|
assertEquals("ok", acl.instanceState);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SkipJVM
|
@SkipJVM
|
||||||
public void loopAndExceptionPhi() {
|
public void loopAndExceptionPhi() {
|
||||||
|
@ -244,13 +251,28 @@ public class VMTest {
|
||||||
public static String bar() {
|
public static String bar() {
|
||||||
return "bar";
|
return "bar";
|
||||||
}
|
}
|
||||||
|
|
||||||
public AsyncClinitClass() {
|
public AsyncClinitClass() {
|
||||||
instanceState += "ok";
|
instanceState += "ok";
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1);
|
Thread.sleep(1);
|
||||||
|
} catch (InterruptedException ie) {
|
||||||
|
throw new RuntimeException(ie);
|
||||||
}
|
}
|
||||||
catch (InterruptedException ie) {
|
}
|
||||||
|
|
||||||
|
public synchronized void doWait() {
|
||||||
|
new Thread(() -> {
|
||||||
|
synchronized (AsyncClinitClass.this) {
|
||||||
|
notify();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread.sleep(1);
|
||||||
|
wait();
|
||||||
|
} catch (InterruptedException ie) {
|
||||||
|
instanceState = "error";
|
||||||
throw new RuntimeException(ie);
|
throw new RuntimeException(ie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -294,4 +316,4 @@ public class VMTest {
|
||||||
super(ONE);
|
super(ONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user