aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/unit/helpers.moon12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/helpers.moon b/test/unit/helpers.moon
index 84dfeb20e9..438f36811c 100644
--- a/test/unit/helpers.moon
+++ b/test/unit/helpers.moon
@@ -97,6 +97,17 @@ cstr = ffi.typeof 'char[?]'
to_cstr = (string) ->
cstr (string.len string) + 1, string
+export vim_init_called
+-- initialize some global variables, this is still necessary to unit test
+-- functions that rely on global state.
+vim_init = ->
+ if vim_init_called ~= nil
+ return
+ -- import os_unix.h for mch_early_init(), which initializes some globals
+ os = cimport './src/nvim/os_unix.h'
+ os.mch_early_init!
+ vim_init_called = true
+
return {
cimport: cimport
cppimport: cppimport
@@ -107,4 +118,5 @@ return {
lib: libnvim
cstr: cstr
to_cstr: to_cstr
+ vim_init: vim_init
}