Closed pcoperatr closed 2 months ago
If I change Testee#codePoints() to:
private static IntStream codePoints(CharSequence str) {
return IntStream.range(0, str.length());
}
All test cases pass and exit:
Running chrome with user data dir: C:\Users\asemenyu\AppData\Local\Temp\teavm18155043029957928249teavm
Running TeaVMNoExitTest
chrome stderr: [0426/111047.172:WARNING:registry_dict.cc(360)] Can't convert registry key to schema type string
chrome stderr: [0426/111047.174:WARNING:registry_dict.cc(360)] Can't convert registry key to schema type string
chrome stderr:
chrome stderr: DevTools listening on ws://127.0.0.1:9222/devtools/browser/523f8da0-a056-4a99-b083-24513d2ea899
testOk: about to exit
testStuck: about to exit
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 14.189 sec - in TeaVMNoExitTest
I'll take a look. And also I'd like to remind you that you can debug tests right in the browser. One quick tip: when test falls into infinite loop, you can't open dev tools. The solution is to edit HTML file and update script to run test on, say, clicking a button. In this case you open HTML file, then open dev tools and click button.
BTW, if your intention was to implement missing CharacterSequence.codePoints
method, than this is the wrong way. Please, take a look at how String.characters
implemented.
No, the intention was different. I had to emulate CharacterSequence.codePoints
to make my code run with TeaVM.
So the problem is not with CharacterSequence.codePoints
.
Please reopen this issue as it is about generated JS code getting stuck.
I closed this issue because I fixed it
I encountered an issue with JUnit4 test method in my project that gets stuck and never exits when executed by TeaVMTestRunner on JS platform. I stripped off all project-specific code and came up TeaVMNoExitTest test case:
Running TeaVMNoExitTest#testOK produces the following output:
testOk: about to exit
is printed and the test exits as expected.Running TeaVMNoExitTest#testStuck produces the following output:
testStuck: about to exit
is printed but the test doesn't exit, the execution gets stuck at this point.Testee#ok and Testee#stuck don't differ much: The first one ends with
.flatMap(Function.identity()).toArray()
and the second one with.toArray()
, the rest is the same. AdditionalStream#flatMap(Function.identity())
call makes a huge difference.My Maven surefire plugin config:
Can reproduce the issue with TeaVM version
0.10.0-SNAPSHOT
(master branch) and also with0.9.2
release.