summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/res/scratch.lisp2
-rw-r--r--test/src/TestLisp.kt15
2 files changed, 16 insertions, 1 deletions
diff --git a/test/res/scratch.lisp b/test/res/scratch.lisp
index 3a1fa66..667f903 100644
--- a/test/res/scratch.lisp
+++ b/test/res/scratch.lisp
@@ -24,3 +24,5 @@
(debuglog "============")
(debuglog "Running tests")
+
+(debuglog "This should be 1.0" (funny-method 1.1 "test" false)) \ No newline at end of file
diff --git a/test/src/TestLisp.kt b/test/src/TestLisp.kt
index 1f287ca..205bea2 100644
--- a/test/src/TestLisp.kt
+++ b/test/src/TestLisp.kt
@@ -1,15 +1,27 @@
+import moe.nea.lisp.LispData
import moe.nea.lisp.LispExecutionContext
import moe.nea.lisp.LispParser
import moe.nea.lisp.TestResultFormatter
+import moe.nea.lisp.bind.AutoBinder
+import moe.nea.lisp.bind.LispBinding
import java.io.File
import javax.xml.stream.XMLOutputFactory
import kotlin.system.exitProcess
object T
+object TestBindings {
+ @LispBinding("funny-method")
+ fun funnyMethod(arg: Int, test: String, boolean: Boolean): LispData {
+ if (boolean)
+ println("From java: $test")
+ return LispData.LispNumber(arg.toDouble())
+ }
+
+}
fun main() {
- val otherP = LispParser.parse(File(T::class.java.getResource("/test.lisp")!!.file))
+ val otherP = LispParser.parse(File(T::class.java.getResource("/scratch.lisp")!!.file))
val executionContext = LispExecutionContext()
executionContext.setupStandardBindings()
executionContext.registerModule(
@@ -17,6 +29,7 @@ fun main() {
LispParser.parse(File(T::class.java.getResource("/secondary.lisp")!!.file))
)
val bindings = executionContext.genBindings()
+ AutoBinder().bindTo(TestBindings, bindings)
val testResults = executionContext.runTests(otherP, "Test", bindings)
val w = XMLOutputFactory.newFactory()
.createXMLStreamWriter(File("TestOutput.xml").bufferedWriter())