diff options
Diffstat (limited to 'test/src')
-rw-r--r-- | test/src/TestLisp.kt | 15 |
1 files changed, 14 insertions, 1 deletions
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()) |