Fix bug in JS string mapping. Remove obsolete test

This commit is contained in:
Alexey Andreev 2015-09-25 17:09:50 +03:00
parent 9b7760c639
commit 7012e9b4d9
3 changed files with 1 additions and 82 deletions

View File

@ -78,6 +78,7 @@ final class JS {
public static native boolean unwrapBoolean(JSObject value); public static native boolean unwrapBoolean(JSObject value);
@InjectedBy(JSNativeGenerator.class) @InjectedBy(JSNativeGenerator.class)
@PluggableDependency(JSNativeGenerator.class)
public static native String unwrapString(JSObject value); public static native String unwrapString(JSObject value);
public static <T extends JSObject> JSArray<T> wrap(T[] array) { public static <T extends JSObject> JSArray<T> wrap(T[] array) {

View File

@ -1,50 +0,0 @@
/*
* Copyright 2015 Alexey Andreev.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.jso.test;
import static org.junit.Assert.*;
import org.junit.Test;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
/**
*
* @author Alexey Andreev
*/
public class JSOTest {
@Test
public void complexConstructorParenthesized() {
RegExp regexp = RegExp.create();
assertEquals(".", regexp.getSource());
}
@Test
public void externalMethodsResolved() {
int r = jsMethod(new Callback() {
@Override public int call() {
return 23;
}
});
assertEquals(23, r);
}
interface Callback extends JSObject {
int call();
}
@JSBody(params = "cb", script = "return cb.call();")
private static native int jsMethod(Callback cb);
}

View File

@ -1,32 +0,0 @@
/*
* Copyright 2015 Alexey Andreev.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.jso.test;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
/**
*
* @author Alexey Andreev
*/
public abstract class RegExp implements JSObject {
@JSProperty
public abstract String getSource();
@JSBody(params = {}, script = "return new RegExp();")
public static native RegExp create();
}