pass typed data back and forth with #extern. close #17

This commit is contained in:
2021-07-26 19:55:28 -06:00
parent 700a4de08b
commit fba736f4f2
4 changed files with 67 additions and 26 deletions

View File

@@ -7,6 +7,7 @@ import kiss.Prelude;
@:build(kiss.Kiss.build())
class ExternTestCase extends Test {
#if (sys || hxnodejs)
function testExternPython() {
_testExternPython();
}
@@ -14,4 +15,5 @@ class ExternTestCase extends Test {
function testExternJavaScript() {
_testExternJavaScript();
}
#end
}

View File

@@ -1,13 +1,10 @@
(function _testExternPython []
(Assert.isTrue
(#extern Bool python []
(#if python
true
false))))
(#extern Bool python [:String passingString "Hello python!"]
(python.NativeStringTools.startswith passingString "Hello"))))
(function _testExternJavaScript []
(Assert.isTrue
(#extern Bool js []
(#if js
true
false))))
(Assert.equals 18
(let [jsToEval "5+6+7"]
(#extern Int js [:String jsToEval _]
(js.Lib.eval jsToEval)))))