Add a test for creating a VM without a config.

This commit is contained in:
Bob Nystrom
2016-03-03 14:31:47 -08:00
parent 41e30f47d8
commit 84bcb5801c
6 changed files with 47 additions and 7 deletions
+21
View File
@@ -0,0 +1,21 @@
#include <string.h>
#include "new_vm.h"
static void nullConfig(WrenVM* vm)
{
WrenVM* otherVM = wrenNewVM(NULL);
// We should be able to execute code.
WrenInterpretResult result = wrenInterpret(otherVM, "1 + 2");
wrenSetSlotBool(vm, 0, result == WREN_RESULT_SUCCESS);
wrenFreeVM(otherVM);
}
WrenForeignMethodFn newVMBindMethod(const char* signature)
{
if (strcmp(signature, "static VM.nullConfig()") == 0) return nullConfig;
return NULL;
}