mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
This commit is contained in:
parent
844da6760c
commit
11f270e3ef
|
@ -34,10 +34,51 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.teavm</groupId>
|
||||||
|
<artifactId>teavm-maven-plugin</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.teavm</groupId>
|
||||||
|
<artifactId>teavm-classlib</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>generate-javascript-tests</id>
|
||||||
|
<goals>
|
||||||
|
<goal>build-test-javascript</goal>
|
||||||
|
</goals>
|
||||||
|
<phase>process-test-classes</phase>
|
||||||
|
<configuration>
|
||||||
|
<minifying>false</minifying>
|
||||||
|
<properties>
|
||||||
|
<java.util.Locale.available>en, en_US, en_GB, ru, ru_RU</java.util.Locale.available>
|
||||||
|
</properties>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>**</exclude>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
|
|
|
@ -74,10 +74,10 @@ public class JSNativeGenerator implements Injector, DependencyPlugin {
|
||||||
writer.append(')');
|
writer.append(')');
|
||||||
break;
|
break;
|
||||||
case "instantiate":
|
case "instantiate":
|
||||||
writer.append("(new ");
|
writer.append("(new (");
|
||||||
context.writeExpr(context.getArgument(0));
|
context.writeExpr(context.getArgument(0));
|
||||||
renderProperty(context.getArgument(1), context);
|
renderProperty(context.getArgument(1), context);
|
||||||
writer.append('(');
|
writer.append(")(");
|
||||||
for (int i = 2; i < context.argumentCount(); ++i) {
|
for (int i = 2; i < context.argumentCount(); ++i) {
|
||||||
if (i > 2) {
|
if (i > 2) {
|
||||||
writer.append(',').ws();
|
writer.append(',').ws();
|
||||||
|
|
21
teavm-jso/src/test/java/org/teavm/jso/test/JSOTest.java
Normal file
21
teavm-jso/src/test/java/org/teavm/jso/test/JSOTest.java
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
package org.teavm.jso.test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.teavm.jso.JS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Alexey Andreev
|
||||||
|
*/
|
||||||
|
public class JSOTest {
|
||||||
|
@Test
|
||||||
|
public void complexConstructorParenthesized() {
|
||||||
|
RegExp regexp = getWindow().createRegExp(".");
|
||||||
|
assertEquals(".", regexp.getSource());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Window getWindow() {
|
||||||
|
return (Window)JS.getGlobal();
|
||||||
|
}
|
||||||
|
}
|
13
teavm-jso/src/test/java/org/teavm/jso/test/RegExp.java
Normal file
13
teavm-jso/src/test/java/org/teavm/jso/test/RegExp.java
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
package org.teavm.jso.test;
|
||||||
|
|
||||||
|
import org.teavm.jso.JSObject;
|
||||||
|
import org.teavm.jso.JSProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Alexey Andreev
|
||||||
|
*/
|
||||||
|
public interface RegExp extends JSObject {
|
||||||
|
@JSProperty
|
||||||
|
String getSource();
|
||||||
|
}
|
13
teavm-jso/src/test/java/org/teavm/jso/test/Window.java
Normal file
13
teavm-jso/src/test/java/org/teavm/jso/test/Window.java
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
package org.teavm.jso.test;
|
||||||
|
|
||||||
|
import org.teavm.jso.JSConstructor;
|
||||||
|
import org.teavm.jso.JSObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Alexey Andreev
|
||||||
|
*/
|
||||||
|
public interface Window extends JSObject {
|
||||||
|
@JSConstructor("RegExp")
|
||||||
|
RegExp createRegExp(String regex);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user