summaryrefslogtreecommitdiff
path: root/src/LispExecutionContext.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/LispExecutionContext.kt')
-rw-r--r--src/LispExecutionContext.kt14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/LispExecutionContext.kt b/src/LispExecutionContext.kt
index 181c06b..ed5c091 100644
--- a/src/LispExecutionContext.kt
+++ b/src/LispExecutionContext.kt
@@ -20,13 +20,25 @@ class LispExecutionContext() {
fun setupStandardBindings() {
CoreBindings.offerAllTo(rootStackFrame)
registerModule("builtins", Builtins.builtinProgram)
+ modules["ntest"] = TestFramework.realizedTestModule
importModule("builtins", rootStackFrame, object : HasLispPosition {
override val position: LispPosition
get() = error("Builtin import failed")
-
})
}
+ fun runTests(
+ program: LispAst.Program,
+ stackFrame: StackFrame = genBindings(),
+ testList: List<String> = emptyList(),
+ isWhitelist: Boolean = false
+ ): TestFramework.TestSuite {
+ val testSuite = TestFramework.setup(stackFrame, testList, isWhitelist)
+ executeProgram(stackFrame, program)
+ return testSuite
+ }
+
+
fun registerModule(moduleName: String, program: LispAst.Program) {
if (moduleName in unloadedModules || moduleName in modules) {
error("Cannot register already registered module $moduleName")