From 99a9161bace8200aa611f6feefcc2ac3eda93251 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 10 Sep 2014 01:17:07 +0000 Subject: [PATCH] unit tests: initialize everything --- test/unit/buffer_spec.lua | 5 ----- test/unit/helpers.lua | 21 +++++++++++++++++++-- test/unit/os/shell_spec.lua | 4 ---- test/unit/tempfile_spec.lua | 5 +++-- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/test/unit/buffer_spec.lua b/test/unit/buffer_spec.lua index 11d99a7bcb..5244c2af86 100644 --- a/test/unit/buffer_spec.lua +++ b/test/unit/buffer_spec.lua @@ -9,11 +9,6 @@ local buffer = helpers.cimport("./src/nvim/buffer.h") local window = helpers.cimport("./src/nvim/window.h") local option = helpers.cimport("./src/nvim/option.h") ---{ Initialize the options needed for interacting with buffers -window.win_alloc_first() -option.set_init_1() ---} - describe('buffer functions', function() local buflist_new = function(file, flags) diff --git a/test/unit/helpers.lua b/test/unit/helpers.lua index 1323893ae2..3f1984f6de 100644 --- a/test/unit/helpers.lua +++ b/test/unit/helpers.lua @@ -127,8 +127,25 @@ local function vim_init() return end -- import os_unix.h for mch_early_init(), which initializes some globals - local os = cimport('./src/nvim/os_unix.h') - os.mch_early_init() + local all = cimport('./src/nvim/os_unix.h', + './src/nvim/misc1.h', + './src/nvim/eval.h', + './src/nvim/os_unix.h', + './src/nvim/option.h', + './src/nvim/ex_cmds2.h', + './src/nvim/window.h', + './src/nvim/ops.h', + './src/nvim/normal.h', + './src/nvim/mbyte.h') + all.mch_early_init() + all.mb_init() + all.eval_init() + all.init_normal_cmds() + all.win_alloc_first() + all.init_yank() + all.init_homedir() + all.set_init_1() + all.set_lang_var() vim_init_called = true end diff --git a/test/unit/os/shell_spec.lua b/test/unit/os/shell_spec.lua index 870034aad9..03aafe7e3c 100644 --- a/test/unit/os/shell_spec.lua +++ b/test/unit/os/shell_spec.lua @@ -24,11 +24,7 @@ local NULL = ffi.cast('void *', 0) describe('shell functions', function() setup(function() - -- the logging functions are complain if I don't do this - shell.init_homedir() - shell.event_init() - -- os_system() can't work when the p_sh and p_shcf variables are unset shell.p_sh = to_cstr('/bin/bash') shell.p_shcf = to_cstr('-c') diff --git a/test/unit/tempfile_spec.lua b/test/unit/tempfile_spec.lua index 9b5cf8bfab..6484a98b8f 100644 --- a/test/unit/tempfile_spec.lua +++ b/test/unit/tempfile_spec.lua @@ -3,11 +3,12 @@ local helpers = require 'test.unit.helpers' local os = helpers.cimport './src/nvim/os/os.h' local tempfile = helpers.cimport './src/nvim/tempfile.h' --- os.mch_early_init + +helpers.vim_init() describe('tempfile related functions', function() after_each(function() - -- tempfile.vim_deltempdir() + tempfile.vim_deltempdir() end) local vim_gettempdir = function()