mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-03 05:44:10 -08:00
Simple test to show expected behavior of resources
This commit is contained in:
parent
1889560c78
commit
4aec89967b
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.classlib.java.lang;
|
package org.teavm.classlib.java.lang;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -266,4 +267,8 @@ public class TClass<T> extends TObject implements TAnnotatedElement {
|
||||||
annotationsByType.put((TClass<?>) (Object) annot.annotationType(), annot);
|
annotationsByType.put((TClass<?>) (Object) annot.annotationType(), annot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InputStream getResourceAsStream(String name) {
|
||||||
|
throw new IllegalStateException("Cannot read resource " + name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,14 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.html4j.test;
|
package org.teavm.html4j.test;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import net.java.html.js.JavaScriptBody;
|
import net.java.html.js.JavaScriptBody;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,6 +30,16 @@ import org.junit.Test;
|
||||||
* @author Alexey Andreev
|
* @author Alexey Andreev
|
||||||
*/
|
*/
|
||||||
public class JavaScriptBodyTest {
|
public class JavaScriptBodyTest {
|
||||||
|
@Test
|
||||||
|
public void readResource() throws IOException {
|
||||||
|
InputStream is = JavaScriptBodyTest.class.getResourceAsStream("jvm.txt");
|
||||||
|
assertNotNull("Resource jvm.txt found", is);
|
||||||
|
try (BufferedReader r = new BufferedReader(new InputStreamReader(is))) {
|
||||||
|
String line = r.readLine();
|
||||||
|
assertEquals("Line read", "TeaVM", line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void javaScriptBodyHandled() {
|
public void javaScriptBodyHandled() {
|
||||||
assertEquals(23, simpleNativeMethod());
|
assertEquals(23, simpleNativeMethod());
|
||||||
|
|
1
html4j/src/test/resources/org/teavm/html4j/test/jvm.txt
Normal file
1
html4j/src/test/resources/org/teavm/html4j/test/jvm.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
TeaVM
|
Loading…
Reference in New Issue
Block a user