From 69f8367389c9d6f60ca594053d9d470e5a8ec999 Mon Sep 17 00:00:00 2001 From: nea Date: Fri, 11 Aug 2023 02:26:00 +0200 Subject: Add output capture and more test reports --- test/src/TestMain.kt | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/src/TestMain.kt (limited to 'test/src/TestMain.kt') diff --git a/test/src/TestMain.kt b/test/src/TestMain.kt new file mode 100644 index 0000000..fc95780 --- /dev/null +++ b/test/src/TestMain.kt @@ -0,0 +1,30 @@ +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 TestMain { + @JvmStatic + fun main(args: Array) { + val reportFile = System.getProperty("test.report") + val modulesToTest = System.getProperty("test.suites").split(":") + val modulePath = System.getProperty("test.imports").split(":") + val executionContext = LispExecutionContext() + executionContext.setupStandardBindings() + modulePath.forEach { + executionContext.registerModule(it, LispParser.parse(File(T::class.java.getResource("/$it.lisp")!!.file))) + } + val allResults = modulesToTest.map { + executionContext.runTests( + LispParser.parse(File(T::class.java.getResource("/$it.lisp")!!.file)), + it, + ) + } + val w = XMLOutputFactory.newFactory() + .createXMLStreamWriter(File(reportFile).bufferedWriter()) + TestResultFormatter.write(w, allResults) + w.close() + + } +} \ No newline at end of file -- cgit