This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s/d-cli | |
... | |
[talkyard-server] $ test | |
... | |
[info] ScalaTest | |
[info] Run completed in 1 minute, 41 seconds. | |
[info] Total number of tests run: 396 | |
[info] Suites: completed 37, aborted 0 | |
[info] Tests: succeeded 396, failed 0, canceled 0, ignored 0, pending 12 | |
[info] All tests passed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- dieIf(!result.isArray, "Not an array") | |
- dieIf(!result.hasSlot(0), "No slot 0") | |
- dieIf(!result.hasSlot(1), "No slot 1") | |
- dieIf(result.hasSlot(2), "Has slot 2") | |
+ dieIf(!result.hasArrayElements, "Not an array") | |
+ dieIf(result.getArraySize != 2, "Array of size != 2") | |
- val elem0 = result.getSlot(0) | |
- dieIf(!elem0.isInstanceOf[String], ...) | |
- val safeHtml = elem0.asInstanceOf[String] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- val htmlOrError = engine.invokeFunction( | |
- "renderReactServerSide", reactStoreJsonString, cdnOrigin.getOrElse("")).asInstanceOf[String] | |
+ val htmlOrError = engine.getBindings("js").getMember("renderReactServerSide") | |
+ .execute(reactStoreJsonString, cdnOrigin.getOrElse("")).asString |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- newEngine.eval(script) | |
+ val scriptSource = graalvm.Source.newBuilder("js", script, "setup").buildLiteral | |
+ newEngine.eval(scriptSource) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- val newEngine = new js.ScriptEngineManager(null).getEngineByName("nashorn") | |
+ val newEngine = graalvm.Context.newBuilder("js").allowAllAccess(true).build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- private def makeJavascriptEngine(): js.ScriptEngine = { | |
+ private def makeJavascriptEngine(): graalvm.Context = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-import javax.{script => js} | |
+import org.graalvm.{polyglot => graalvm} |