Closed ldubost closed 8 months ago
Can you please provide a test?
@konsoletyper I suppose author won't add test. But he's right. Here is a test that proves his PR, it can be added after the merge. Strangely nobody caught this earlier.
@Test
public void testOffer() {
LinkedList<String> list = new LinkedList<>();
list.offer("1");
list.offer("2");
assertEquals("1", list.getFirst());
assertEquals("2", list.getLast());
}
Actually I wanted to provide a test, which I wrote. But I could not find how to run the tests to verify the test was ok.
See test
module. All classlib tests are located in org.teavm.classlib
package, in sub-packages named after Java class library packages. For your particular case, there's org.teavm.classlib.java.util.LinkedListTest
class. To run tests, run
./gradlew -Pteavm.tests.wasi=false -Pteavm.tests.c=true test
or to test single class
./gradlew -Pteavm.tests.wasi=false -Pteavm.tests.c=true :tests:test --tests "org.teavm.classlib.java.util.LinkedListTest"
You can also use IDE to run particular test class or method, but by default TeaVM may try to run tests for C and WASI BE, which require additional setup. Unless you want to setup environment, you can open gradle.properties
file and if you find there following lines:
teavm.tests.wasi=true
teavm.tests.c=true
comment them out.
This is a fix for issue #772