summaryrefslogtreecommitdiff
path: root/test/src/TestLisp.kt
blob: 1f0c42406bb37ab448401c1de7f5143967f057d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import moe.nea.lisp.LispExecutionContext
import moe.nea.lisp.LispParser
import moe.nea.lisp.TestResultFormatter
import java.io.File
import javax.xml.stream.XMLOutputFactory

object T


fun main() {
    val otherP = LispParser.parse(File(T::class.java.getResource("/test.lisp")!!.file))
    val executionContext = LispExecutionContext()
    executionContext.setupStandardBindings()
    executionContext.registerModule(
        "secondary",
        LispParser.parse(File(T::class.java.getResource("/secondary.lisp")!!.file))
    )
    val bindings = executionContext.genBindings()
    val testResults = executionContext.runTests(otherP, "Test", bindings)
    val w = XMLOutputFactory.newFactory()
        .createXMLStreamWriter(File("TestOutput.xml").bufferedWriter())
    TestResultFormatter.write(w, listOf(testResults))
    w.close()
}