diff options
author | Nicolas Hillegeer <nicolas@hillegeer.com> | 2014-07-12 19:37:38 +0200 |
---|---|---|
committer | Nicolas Hillegeer <nicolas@hillegeer.com> | 2014-07-16 19:05:35 +0200 |
commit | c376cf46bf7672772d1b5fec218c44c9fb6cd2de (patch) | |
tree | 1809e07526e271f0fb13b18a6003c781f6111292 | |
parent | 32ddfec84f9335673e38b31950544a24304697f8 (diff) | |
download | rneovim-c376cf46bf7672772d1b5fec218c44c9fb6cd2de.tar.gz rneovim-c376cf46bf7672772d1b5fec218c44c9fb6cd2de.tar.bz2 rneovim-c376cf46bf7672772d1b5fec218c44c9fb6cd2de.zip |
test/helpers: add 'vim_init' helper
- Initializes some global variables.
- Necessary for the buffer tests in PR #904.
-rw-r--r-- | test/unit/helpers.moon | 12 |
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 } |