mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-08 07:54:11 -08:00
Fix bugs in metaprogramming. In JUnit runner reload about:blank page before every test
This commit is contained in:
parent
edb3d2ff48
commit
ccb4dff836
|
@ -80,7 +80,8 @@ public final class Metaprogramming {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> Value<T> proxy(Class<T> type, InvocationHandler<T> handler) {
|
public static <T> Value<T> proxy(Class<T> type, InvocationHandler<T> handler) {
|
||||||
return proxy(findClass(type), handler);
|
unsupported();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> Value<T> proxy(ReflectClass<T> type, InvocationHandler<T> handler) {
|
public static <T> Value<T> proxy(ReflectClass<T> type, InvocationHandler<T> handler) {
|
||||||
|
|
|
@ -176,11 +176,11 @@ public final class MetaprogrammingImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void location(String fileName, int lineNumber) {
|
public static void location(String fileName, int lineNumber) {
|
||||||
unsupported();
|
generator.forcedLocation = new TextLocation(fileName, lineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void defaultLocation() {
|
public static void defaultLocation() {
|
||||||
unsupported();
|
generator.forcedLocation = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("WeakerAccess")
|
@SuppressWarnings("WeakerAccess")
|
||||||
|
@ -249,6 +249,7 @@ public final class MetaprogrammingImpl {
|
||||||
returnType = methodHolder.getResultType();
|
returnType = methodHolder.getResultType();
|
||||||
varContext = nestedVarContext;
|
varContext = nestedVarContext;
|
||||||
generator = new CompositeMethodGenerator(varContext, new Program());
|
generator = new CompositeMethodGenerator(varContext, new Program());
|
||||||
|
generator.forcedLocation = generatorBackup.forcedLocation;
|
||||||
|
|
||||||
Program program = generator.program;
|
Program program = generator.program;
|
||||||
program.createBasicBlock();
|
program.createBasicBlock();
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>teavm-junit</artifactId>
|
<artifactId>teavm-junit</artifactId>
|
||||||
|
<name>TeaVM JUnit runner</name>
|
||||||
|
<description>TeaVM implementation of JUnit API</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -52,6 +52,11 @@ class HtmlUnitRunStrategy implements TestRunStrategy {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
page.set(webClient.get().getPage("about:blank"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
page.get().executeJavaScript(readFile(new File(run.getBaseDirectory(), "runtime.js")));
|
page.get().executeJavaScript(readFile(new File(run.getBaseDirectory(), "runtime.js")));
|
||||||
page.get().executeJavaScript(readFile(new File(run.getBaseDirectory(), "test.js")));
|
page.get().executeJavaScript(readFile(new File(run.getBaseDirectory(), "test.js")));
|
||||||
|
|
||||||
|
@ -75,11 +80,6 @@ class HtmlUnitRunStrategy implements TestRunStrategy {
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
webClient.set(new WebClient(BrowserVersion.CHROME));
|
webClient.set(new WebClient(BrowserVersion.CHROME));
|
||||||
try {
|
|
||||||
page.set(webClient.get().<HtmlPage>getPage("about:blank"));
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String readFile(File file) throws IOException {
|
private String readFile(File file) throws IOException {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user