diff options
author | nea <nea@nea.moe> | 2023-08-10 16:05:11 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-08-10 16:05:11 +0200 |
commit | 0ab6dab185e31fcf6f3e0cf98dc8496f02448ee8 (patch) | |
tree | f5e646246a888ba76f040a7ab81ca6a4d8cdee7c /src/LispExecutionContext.kt | |
parent | f345fadd492ea5bb09e515d007be438fc08c9b93 (diff) | |
download | nealisp-0ab6dab185e31fcf6f3e0cf98dc8496f02448ee8.tar.gz nealisp-0ab6dab185e31fcf6f3e0cf98dc8496f02448ee8.tar.bz2 nealisp-0ab6dab185e31fcf6f3e0cf98dc8496f02448ee8.zip |
Basic tests
Diffstat (limited to 'src/LispExecutionContext.kt')
-rw-r--r-- | src/LispExecutionContext.kt | 14 |
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") |