diff options
author | nea <nea@nea.moe> | 2023-08-11 02:26:00 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-08-11 02:26:00 +0200 |
commit | 69f8367389c9d6f60ca594053d9d470e5a8ec999 (patch) | |
tree | 4fe2d341ca9ec9b8aaa0ec5cb18c53bf63265844 /test | |
parent | 912c9918d9a5afbfb023b650bed6e2754f030d5e (diff) | |
download | nealisp-69f8367389c9d6f60ca594053d9d470e5a8ec999.tar.gz nealisp-69f8367389c9d6f60ca594053d9d470e5a8ec999.tar.bz2 nealisp-69f8367389c9d6f60ca594053d9d470e5a8ec999.zip |
Add output capture and more test reports
Diffstat (limited to 'test')
-rw-r--r-- | test/res/test.lisp | 9 | ||||
-rw-r--r-- | test/src/TestMain.kt | 30 |
2 files changed, 34 insertions, 5 deletions
diff --git a/test/res/test.lisp b/test/res/test.lisp index 79d259d..9def7f3 100644 --- a/test/res/test.lisp +++ b/test/res/test.lisp @@ -25,11 +25,10 @@ (debuglog "============") (debuglog "Running tests") (import :test) -(test.test "Funny test" (seq - (debuglog "Funny test running") - ((test.assert false "False failed")) - ((test.assert-eq "funny" "unfunny")) - ((test.fail "Test failed")))) +(test.test "unfunny test" (seq + (debuglog "Funny test not running") + ((test.assert-eq "unfunny" "funny")) +)) (test.test "Test equality" (seq ((test.assert-eq false false)) 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<String>) { + 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 |