mirror of
https://github.com/konsoletyper/teavm.git
synced 2024-11-27 01:30:35 +08:00
Add test for asynchronous class initialisation from asynchronous constructor.
This commit is contained in:
parent
230ebaf420
commit
34961e4d9d
@ -160,6 +160,13 @@ public class VMTest {
|
||||
assertEquals("ok", AsyncClinitClass.state);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void asyncClinitInstance() {
|
||||
AsyncClinitClass acl = new AsyncClinitClass();
|
||||
assertEquals("ok", AsyncClinitClass.state);
|
||||
assertEquals("ok", acl.instanceState);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SkipJVM
|
||||
public void loopAndExceptionPhi() {
|
||||
@ -218,6 +225,7 @@ public class VMTest {
|
||||
|
||||
private static class AsyncClinitClass {
|
||||
static String state = "";
|
||||
String instanceState = "";
|
||||
|
||||
static {
|
||||
initCount++;
|
||||
@ -236,6 +244,16 @@ public class VMTest {
|
||||
public static String bar() {
|
||||
return "bar";
|
||||
}
|
||||
|
||||
public AsyncClinitClass() {
|
||||
instanceState += "ok";
|
||||
try {
|
||||
Thread.sleep(1);
|
||||
}
|
||||
catch (InterruptedException ie) {
|
||||
throw new RuntimeException(ie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void throwException() {
|
||||
|
Loading…
Reference in New Issue
Block a user