diff options
| author | dundargoc <gocdundar@gmail.com> | 2024-04-08 11:03:20 +0200 |
|---|---|---|
| committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2024-04-08 22:51:00 +0200 |
| commit | 7035125b2b26aa68fcfb7cda39377ac79926a0f9 (patch) | |
| tree | d194a3556a367b42505f9e7d26637e7cb3674928 /test/unit | |
| parent | 978962f9a00ce75216d2c36b79397ef3d2b54096 (diff) | |
| download | rneovim-7035125b2b26aa68fcfb7cda39377ac79926a0f9.tar.gz rneovim-7035125b2b26aa68fcfb7cda39377ac79926a0f9.tar.bz2 rneovim-7035125b2b26aa68fcfb7cda39377ac79926a0f9.zip | |
test: improve test conventions
Work on https://github.com/neovim/neovim/issues/27004.
Diffstat (limited to 'test/unit')
41 files changed, 436 insertions, 439 deletions
diff --git a/test/unit/api/private_helpers_spec.lua b/test/unit/api/private_helpers_spec.lua index 9843bd5c9e..282a2e7f8e 100644 --- a/test/unit/api/private_helpers_spec.lua +++ b/test/unit/api/private_helpers_spec.lua @@ -1,24 +1,24 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) -local eval_helpers = require('test.unit.eval.helpers') -local api_helpers = require('test.unit.api.helpers') - -local cimport = helpers.cimport -local NULL = helpers.NULL -local eq = helpers.eq - -local lua2typvalt = eval_helpers.lua2typvalt -local typvalt2lua = eval_helpers.typvalt2lua -local typvalt = eval_helpers.typvalt - -local nil_value = api_helpers.nil_value -local list_type = api_helpers.list_type -local int_type = api_helpers.int_type -local type_key = api_helpers.type_key -local obj2lua = api_helpers.obj2lua -local func_type = api_helpers.func_type - -local api = cimport('./src/nvim/api/private/helpers.h', './src/nvim/api/private/converter.h') +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) +local t_eval = require('test.unit.eval.testutil') +local api_t = require('test.unit.api.testutil') + +local cimport = t.cimport +local NULL = t.NULL +local eq = t.eq + +local lua2typvalt = t_eval.lua2typvalt +local typvalt2lua = t_eval.typvalt2lua +local typvalt = t_eval.typvalt + +local nil_value = api_t.nil_value +local list_type = api_t.list_type +local int_type = api_t.int_type +local type_key = api_t.type_key +local obj2lua = api_t.obj2lua +local func_type = api_t.func_type + +local api = cimport('./src/nvim/api/private/t.h', './src/nvim/api/private/converter.h') describe('vim_to_object', function() local vim_to_object = function(l) diff --git a/test/unit/api/helpers.lua b/test/unit/api/testutil.lua index 23c5db43f7..2790bca085 100644 --- a/test/unit/api/helpers.lua +++ b/test/unit/api/testutil.lua @@ -1,23 +1,20 @@ -local helpers = require('test.unit.helpers')(nil) -local eval_helpers = require('test.unit.eval.helpers') +local t = require('test.unit.testutil')(nil) +local t_eval = require('test.unit.eval.testutil') -local cimport = helpers.cimport -local to_cstr = helpers.to_cstr -local ffi = helpers.ffi +local cimport = t.cimport +local to_cstr = t.to_cstr +local ffi = t.ffi -local list_type = eval_helpers.list_type -local dict_type = eval_helpers.dict_type -local func_type = eval_helpers.func_type -local nil_value = eval_helpers.nil_value -local int_type = eval_helpers.int_type -local flt_type = eval_helpers.flt_type -local type_key = eval_helpers.type_key +local list_type = t_eval.list_type +local dict_type = t_eval.dict_type +local func_type = t_eval.func_type +local nil_value = t_eval.nil_value +local int_type = t_eval.int_type +local flt_type = t_eval.flt_type +local type_key = t_eval.type_key -local api = cimport( - './src/nvim/api/private/defs.h', - './src/nvim/api/private/helpers.h', - './src/nvim/memory.h' -) +local api = + cimport('./src/nvim/api/private/defs.h', './src/nvim/api/private/t.h', './src/nvim/memory.h') local obj2lua diff --git a/test/unit/buffer_spec.lua b/test/unit/buffer_spec.lua index 1ef3e97165..beedc6b5f1 100644 --- a/test/unit/buffer_spec.lua +++ b/test/unit/buffer_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local to_cstr = helpers.to_cstr -local eq = helpers.eq -local NULL = helpers.NULL +local to_cstr = t.to_cstr +local eq = t.eq +local NULL = t.NULL -local buffer = helpers.cimport('./src/nvim/buffer.h') +local buffer = t.cimport('./src/nvim/buffer.h') describe('buffer functions', function() local buflist_new = function(file, flags) diff --git a/test/unit/charset/vim_str2nr_spec.lua b/test/unit/charset/vim_str2nr_spec.lua index ad87d026e5..f83fc3b96b 100644 --- a/test/unit/charset/vim_str2nr_spec.lua +++ b/test/unit/charset/vim_str2nr_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.unit.helpers')(after_each) +local t = require('test.unit.testutil')(after_each) local bit = require('bit') -local itp = helpers.gen_itp(it) +local itp = t.gen_itp(it) -local child_call_once = helpers.child_call_once -local cimport = helpers.cimport -local ffi = helpers.ffi +local child_call_once = t.child_call_once +local cimport = t.cimport +local ffi = t.ffi local lib = cimport('./src/nvim/charset.h') diff --git a/test/unit/eval/decode_spec.lua b/test/unit/eval/decode_spec.lua index 5a8374a2a6..1f36d95473 100644 --- a/test/unit/eval/decode_spec.lua +++ b/test/unit/eval/decode_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local cimport = helpers.cimport -local eq = helpers.eq -local neq = helpers.neq -local ffi = helpers.ffi +local cimport = t.cimport +local eq = t.eq +local neq = t.neq +local ffi = t.ffi local decode = cimport( './src/nvim/eval/decode.h', diff --git a/test/unit/eval/encode_spec.lua b/test/unit/eval/encode_spec.lua index 498346d7cc..d0eeedf4b0 100644 --- a/test/unit/eval/encode_spec.lua +++ b/test/unit/eval/encode_spec.lua @@ -1,16 +1,16 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) -local eval_helpers = require('test.unit.eval.helpers') +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) +local t_eval = require('test.unit.eval.testutil') -local cimport = helpers.cimport -local to_cstr = helpers.to_cstr -local eq = helpers.eq +local cimport = t.cimport +local to_cstr = t.to_cstr +local eq = t.eq -local list = eval_helpers.list -local lst2tbl = eval_helpers.lst2tbl -local type_key = eval_helpers.type_key -local list_type = eval_helpers.list_type -local null_string = eval_helpers.null_string +local list = t_eval.list +local lst2tbl = t_eval.lst2tbl +local type_key = t_eval.type_key +local list_type = t_eval.list_type +local null_string = t_eval.null_string local encode = cimport('./src/nvim/eval/encode.h') diff --git a/test/unit/eval/helpers.lua b/test/unit/eval/testutil.lua index 6402e1f8c9..5809877341 100644 --- a/test/unit/eval/helpers.lua +++ b/test/unit/eval/testutil.lua @@ -1,10 +1,10 @@ -local helpers = require('test.unit.helpers')(nil) +local t = require('test.unit.testutil')(nil) -local ptr2key = helpers.ptr2key -local cimport = helpers.cimport -local to_cstr = helpers.to_cstr -local ffi = helpers.ffi -local eq = helpers.eq +local ptr2key = t.ptr2key +local cimport = t.cimport +local to_cstr = t.to_cstr +local ffi = t.ffi +local eq = t.eq local eval = cimport( './src/nvim/eval.h', @@ -142,56 +142,56 @@ local function typvalt2lua_tab_init() return end typvalt2lua_tab = { - [tonumber(eval.VAR_BOOL)] = function(t) + [tonumber(eval.VAR_BOOL)] = function(q) return ({ [tonumber(eval.kBoolVarFalse)] = false, [tonumber(eval.kBoolVarTrue)] = true, - })[tonumber(t.vval.v_bool)] + })[tonumber(q.vval.v_bool)] end, - [tonumber(eval.VAR_SPECIAL)] = function(t) + [tonumber(eval.VAR_SPECIAL)] = function(q) return ({ [tonumber(eval.kSpecialVarNull)] = nil_value, - })[tonumber(t.vval.v_special)] + })[tonumber(q.vval.v_special)] end, - [tonumber(eval.VAR_NUMBER)] = function(t) - return { [type_key] = int_type, value = tonumber(t.vval.v_number) } + [tonumber(eval.VAR_NUMBER)] = function(q) + return { [type_key] = int_type, value = tonumber(q.vval.v_number) } end, - [tonumber(eval.VAR_FLOAT)] = function(t) - return tonumber(t.vval.v_float) + [tonumber(eval.VAR_FLOAT)] = function(q) + return tonumber(q.vval.v_float) end, - [tonumber(eval.VAR_STRING)] = function(t) - local str = t.vval.v_string + [tonumber(eval.VAR_STRING)] = function(q) + local str = q.vval.v_string if str == nil then return null_string else return ffi.string(str) end end, - [tonumber(eval.VAR_LIST)] = function(t, processed) - return lst2tbl(t.vval.v_list, processed) + [tonumber(eval.VAR_LIST)] = function(q, processed) + return lst2tbl(q.vval.v_list, processed) end, - [tonumber(eval.VAR_DICT)] = function(t, processed) - return dct2tbl(t.vval.v_dict, processed) + [tonumber(eval.VAR_DICT)] = function(q, processed) + return dct2tbl(q.vval.v_dict, processed) end, - [tonumber(eval.VAR_FUNC)] = function(t, processed) - return { [type_key] = func_type, value = typvalt2lua_tab[eval.VAR_STRING](t, processed or {}) } + [tonumber(eval.VAR_FUNC)] = function(q, processed) + return { [type_key] = func_type, value = typvalt2lua_tab[eval.VAR_STRING](q, processed or {}) } end, - [tonumber(eval.VAR_PARTIAL)] = function(t, processed) - local p_key = ptr2key(t) + [tonumber(eval.VAR_PARTIAL)] = function(q, processed) + local p_key = ptr2key(q) if processed[p_key] then return processed[p_key] end - return partial2lua(t.vval.v_partial, processed) + return partial2lua(q.vval.v_partial, processed) end, } end -typvalt2lua = function(t, processed) +typvalt2lua = function(q, processed) typvalt2lua_tab_init() return ( - (typvalt2lua_tab[tonumber(t.v_type)] or function(t_inner) + (typvalt2lua_tab[tonumber(q.v_type)] or function(t_inner) assert(false, 'Converting ' .. tonumber(t_inner.v_type) .. ' was not implemented yet') - end)(t, processed or {}) + end)(q, processed or {}) ) end @@ -419,7 +419,7 @@ local function alloc_len(len, get_ptr) end end -local alloc_logging_helpers = { +local alloc_logging_t = { list = function(l) return { func = 'calloc', args = { 1, ffi.sizeof('list_T') }, ret = void(l) } end, @@ -523,7 +523,7 @@ local function tbl2callback(tbl) else assert(false) end - return ffi.gc(ffi.cast('Callback*', ret), helpers.callback_free) + return ffi.gc(ffi.cast('Callback*', ret), t.callback_free) end local function dict_watchers(d) @@ -591,7 +591,7 @@ return { list_iter = list_iter, first_di = first_di, - alloc_logging_helpers = alloc_logging_helpers, + alloc_logging_t = alloc_logging_t, list_items = list_items, dict_items = dict_items, diff --git a/test/unit/eval/tricks_spec.lua b/test/unit/eval/tricks_spec.lua index ed26fd44e4..c67bfa4fac 100644 --- a/test/unit/eval/tricks_spec.lua +++ b/test/unit/eval/tricks_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.unit.helpers')(after_each) -local eval_helpers = require('test.unit.eval.helpers') +local t = require('test.unit.testutil')(after_each) +local t_eval = require('test.unit.eval.testutil') -local itp = helpers.gen_itp(it) +local itp = t.gen_itp(it) -local cimport = helpers.cimport -local eq = helpers.eq +local cimport = t.cimport +local eq = t.eq -local eval0 = eval_helpers.eval0 +local eval0 = t_eval.eval0 local eval = cimport('./src/nvim/eval.h', './src/nvim/eval/typval.h', './src/nvim/memory.h') diff --git a/test/unit/eval/tv_clear_spec.lua b/test/unit/eval/tv_clear_spec.lua index a34cf6082a..86ddde9d7d 100644 --- a/test/unit/eval/tv_clear_spec.lua +++ b/test/unit/eval/tv_clear_spec.lua @@ -1,18 +1,18 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) -local eval_helpers = require('test.unit.eval.helpers') +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) +local t_eval = require('test.unit.eval.testutil') -local alloc_log_new = helpers.alloc_log_new -local cimport = helpers.cimport -local ffi = helpers.ffi -local eq = helpers.eq +local alloc_log_new = t.alloc_log_new +local cimport = t.cimport +local ffi = t.ffi +local eq = t.eq -local a = eval_helpers.alloc_logging_helpers -local type_key = eval_helpers.type_key -local list_type = eval_helpers.list_type -local list_items = eval_helpers.list_items -local dict_items = eval_helpers.dict_items -local lua2typvalt = eval_helpers.lua2typvalt +local a = t_eval.alloc_logging_t +local type_key = t_eval.type_key +local list_type = t_eval.list_type +local list_items = t_eval.list_items +local dict_items = t_eval.dict_items +local lua2typvalt = t_eval.lua2typvalt local lib = cimport('./src/nvim/eval/typval.h', './src/nvim/eval.h') diff --git a/test/unit/eval/typval_spec.lua b/test/unit/eval/typval_spec.lua index a775bb48b4..029a6d53a4 100644 --- a/test/unit/eval/typval_spec.lua +++ b/test/unit/eval/typval_spec.lua @@ -1,45 +1,45 @@ local bit = require('bit') -local helpers = require('test.unit.helpers')(after_each) -local eval_helpers = require('test.unit.eval.helpers') - -local itp = helpers.gen_itp(it) - -local OK = helpers.OK -local eq = helpers.eq -local neq = helpers.neq -local ffi = helpers.ffi -local FAIL = helpers.FAIL -local NULL = helpers.NULL -local cimport = helpers.cimport -local to_cstr = helpers.to_cstr -local alloc_log_new = helpers.alloc_log_new -local concat_tables = helpers.concat_tables +local t = require('test.unit.testutil')(after_each) +local t_eval = require('test.unit.eval.testutil') + +local itp = t.gen_itp(it) + +local OK = t.OK +local eq = t.eq +local neq = t.neq +local ffi = t.ffi +local FAIL = t.FAIL +local NULL = t.NULL +local cimport = t.cimport +local to_cstr = t.to_cstr +local alloc_log_new = t.alloc_log_new +local concat_tables = t.concat_tables local map = vim.tbl_map -local a = eval_helpers.alloc_logging_helpers -local int = eval_helpers.int -local list = eval_helpers.list -local dict = eval_helpers.dict -local eval0 = eval_helpers.eval0 -local lst2tbl = eval_helpers.lst2tbl -local dct2tbl = eval_helpers.dct2tbl -local typvalt = eval_helpers.typvalt -local type_key = eval_helpers.type_key -local li_alloc = eval_helpers.li_alloc -local first_di = eval_helpers.first_di -local nil_value = eval_helpers.nil_value -local func_type = eval_helpers.func_type -local null_list = eval_helpers.null_list -local null_dict = eval_helpers.null_dict -local dict_items = eval_helpers.dict_items -local list_items = eval_helpers.list_items -local empty_list = eval_helpers.empty_list -local lua2typvalt = eval_helpers.lua2typvalt -local typvalt2lua = eval_helpers.typvalt2lua -local null_string = eval_helpers.null_string -local callback2tbl = eval_helpers.callback2tbl -local tbl2callback = eval_helpers.tbl2callback -local dict_watchers = eval_helpers.dict_watchers +local a = t_eval.alloc_logging_t +local int = t_eval.int +local list = t_eval.list +local dict = t_eval.dict +local eval0 = t_eval.eval0 +local lst2tbl = t_eval.lst2tbl +local dct2tbl = t_eval.dct2tbl +local typvalt = t_eval.typvalt +local type_key = t_eval.type_key +local li_alloc = t_eval.li_alloc +local first_di = t_eval.first_di +local nil_value = t_eval.nil_value +local func_type = t_eval.func_type +local null_list = t_eval.null_list +local null_dict = t_eval.null_dict +local dict_items = t_eval.dict_items +local list_items = t_eval.list_items +local empty_list = t_eval.empty_list +local lua2typvalt = t_eval.lua2typvalt +local typvalt2lua = t_eval.typvalt2lua +local null_string = t_eval.null_string +local callback2tbl = t_eval.callback2tbl +local tbl2callback = t_eval.tbl2callback +local dict_watchers = t_eval.dict_watchers local lib = cimport( './src/nvim/eval/typval.h', diff --git a/test/unit/fileio_spec.lua b/test/unit/fileio_spec.lua index 1284f84222..55332cee87 100644 --- a/test/unit/fileio_spec.lua +++ b/test/unit/fileio_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) ---{:cimport, :internalize, :eq, :neq, :ffi, :lib, :cstr, :to_cstr} = require 'test.unit.helpers' +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) +--{:cimport, :internalize, :eq, :neq, :ffi, :lib, :cstr, :to_cstr} = require 'test.unit.testutil' -local eq = helpers.eq -local ffi = helpers.ffi -local to_cstr = helpers.to_cstr -local NULL = helpers.NULL +local eq = t.eq +local ffi = t.ffi +local to_cstr = t.to_cstr +local NULL = t.NULL -local fileio = helpers.cimport('./src/nvim/fileio.h') +local fileio = t.cimport('./src/nvim/fileio.h') describe('file_pat functions', function() describe('file_pat_to_reg_pat', function() diff --git a/test/unit/garray_spec.lua b/test/unit/garray_spec.lua index 0f947c42b8..f0b991a051 100644 --- a/test/unit/garray_spec.lua +++ b/test/unit/garray_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) - -local cimport = helpers.cimport -local internalize = helpers.internalize -local eq = helpers.eq -local neq = helpers.neq -local ffi = helpers.ffi -local to_cstr = helpers.to_cstr -local NULL = helpers.NULL +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) + +local cimport = t.cimport +local internalize = t.internalize +local eq = t.eq +local neq = t.neq +local ffi = t.ffi +local to_cstr = t.to_cstr +local NULL = t.NULL local garray = cimport('./src/nvim/garray.h') diff --git a/test/unit/indent_spec.lua b/test/unit/indent_spec.lua index 7902918c54..8fa848b086 100644 --- a/test/unit/indent_spec.lua +++ b/test/unit/indent_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local to_cstr = helpers.to_cstr -local ffi = helpers.ffi -local eq = helpers.eq +local to_cstr = t.to_cstr +local ffi = t.ffi +local eq = t.eq -local indent = helpers.cimport('./src/nvim/indent.h') -local globals = helpers.cimport('./src/nvim/globals.h') +local indent = t.cimport('./src/nvim/indent.h') +local globals = t.cimport('./src/nvim/globals.h') describe('get_sts_value', function() itp([[returns 'softtabstop' when it is non-negative]], function() diff --git a/test/unit/keycodes_spec.lua b/test/unit/keycodes_spec.lua index 4a81c62ac1..7c8fd47c21 100644 --- a/test/unit/keycodes_spec.lua +++ b/test/unit/keycodes_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local ffi = helpers.ffi -local eq = helpers.eq -local neq = helpers.neq +local ffi = t.ffi +local eq = t.eq +local neq = t.neq -local keycodes = helpers.cimport('./src/nvim/keycodes.h') -local NULL = helpers.NULL +local keycodes = t.cimport('./src/nvim/keycodes.h') +local NULL = t.NULL describe('keycodes.c', function() describe('find_special_key()', function() diff --git a/test/unit/marktree_spec.lua b/test/unit/marktree_spec.lua index b0a861727d..3e6081a078 100644 --- a/test/unit/marktree_spec.lua +++ b/test/unit/marktree_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local ffi = helpers.ffi -local eq = helpers.eq -local ok = helpers.ok +local ffi = t.ffi +local eq = t.eq +local ok = t.ok -local lib = helpers.cimport('./src/nvim/marktree.h') +local lib = t.cimport('./src/nvim/marktree.h') -local function tablelength(t) +local function tablelength(tbl) local count = 0 - for _ in pairs(t) do + for _ in pairs(tbl) do count = count + 1 end return count @@ -460,7 +460,7 @@ describe('marktree', function() local ids = {} -- too much overhead on ASAN - local size_factor = helpers.is_asan() and 3 or 10 + local size_factor = t.is_asan() and 3 or 10 local at_row = {} for i = 1, 10 do @@ -528,7 +528,7 @@ describe('marktree', function() local tree = ffi.new('MarkTree[1]') -- zero initialized by luajit -- too much overhead on ASAN - local size_factor = helpers.is_asan() and 3 or 10 + local size_factor = t.is_asan() and 3 or 10 local at_row = {} for i = 1, 10 do diff --git a/test/unit/mbyte_spec.lua b/test/unit/mbyte_spec.lua index 00a8c06ceb..1a28f9c43d 100644 --- a/test/unit/mbyte_spec.lua +++ b/test/unit/mbyte_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local ffi = helpers.ffi -local eq = helpers.eq +local ffi = t.ffi +local eq = t.eq -local lib = helpers.cimport('./src/nvim/mbyte.h', './src/nvim/charset.h', './src/nvim/grid.h') +local lib = t.cimport('./src/nvim/mbyte.h', './src/nvim/charset.h', './src/nvim/grid.h') describe('mbyte', function() -- Convert from bytes to string @@ -205,7 +205,7 @@ describe('mbyte', function() end) describe('utf_cp_bounds_len', function() - local to_cstr = helpers.to_cstr + local to_cstr = t.to_cstr local tests = { { diff --git a/test/unit/memory_spec.lua b/test/unit/memory_spec.lua index 8be55fdbf3..fb49bdf8e5 100644 --- a/test/unit/memory_spec.lua +++ b/test/unit/memory_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local cimport = helpers.cimport -local cstr = helpers.cstr -local eq = helpers.eq -local ffi = helpers.ffi -local to_cstr = helpers.to_cstr +local cimport = t.cimport +local cstr = t.cstr +local eq = t.eq +local ffi = t.ffi +local to_cstr = t.to_cstr local cimp = cimport('stdlib.h', './src/nvim/memory.h') diff --git a/test/unit/message_spec.lua b/test/unit/message_spec.lua index 71aa74d90d..5653f8ee5b 100644 --- a/test/unit/message_spec.lua +++ b/test/unit/message_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local ffi = helpers.ffi -local eq = helpers.eq -local to_cstr = helpers.to_cstr +local ffi = t.ffi +local eq = t.eq +local to_cstr = t.to_cstr -local cimp = helpers.cimport('./src/nvim/message.h', './src/nvim/memory.h', './src/nvim/strings.h') +local cimp = t.cimport('./src/nvim/message.h', './src/nvim/memory.h', './src/nvim/strings.h') describe('trunc_string', function() local buflen = 40 @@ -33,26 +33,26 @@ describe('trunc_string', function() { ['desc'] = 'by copy', ['func'] = test_copy }, } - for _, t in ipairs(permutations) do - describe('populates buf ' .. t.desc, function() + for _, q in ipairs(permutations) do + describe('populates buf ' .. q.desc, function() itp('with a small string', function() - t.func('text', 'text') + q.func('text', 'text') end) itp('with a medium string', function() - t.func('a short text', 'a short text') + q.func('a short text', 'a short text') end) itp('with a string of length == 1/2 room', function() - t.func('a text that fits', 'a text that fits', 34) + q.func('a text that fits', 'a text that fits', 34) end) itp('with a string exactly the truncate size', function() - t.func('a text tha just fits', 'a text tha just fits') + q.func('a text tha just fits', 'a text tha just fits') end) itp('with a string that must be truncated', function() - t.func('a text that nott fits', 'a text t...nott fits') + q.func('a text that nott fits', 'a text t...nott fits') end) end) end diff --git a/test/unit/msgpack_spec.lua b/test/unit/msgpack_spec.lua index f9fde00a85..0bebbef141 100644 --- a/test/unit/msgpack_spec.lua +++ b/test/unit/msgpack_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.unit.helpers')(after_each) -local cimport = helpers.cimport -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local cimport = t.cimport +local itp = t.gen_itp(it) local lib = cimport('./src/nvim/msgpack_rpc/unpacker.h', './src/nvim/memory.h') -local ffi = helpers.ffi -local eq = helpers.eq -local to_cstr = helpers.to_cstr +local ffi = t.ffi +local eq = t.eq +local to_cstr = t.to_cstr --- @class Unpacker --- @field read_ptr ffi.cdata* diff --git a/test/unit/multiqueue_spec.lua b/test/unit/multiqueue_spec.lua index f6d11ebed0..0866bc1f0c 100644 --- a/test/unit/multiqueue_spec.lua +++ b/test/unit/multiqueue_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local child_call_once = helpers.child_call_once -local cimport = helpers.cimport -local ffi = helpers.ffi -local eq = helpers.eq +local child_call_once = t.child_call_once +local cimport = t.cimport +local ffi = t.ffi +local eq = t.eq local multiqueue = cimport('./test/unit/fixtures/multiqueue.h') diff --git a/test/unit/optionstr_spec.lua b/test/unit/optionstr_spec.lua index 7666db910e..37fe4a3a3b 100644 --- a/test/unit/optionstr_spec.lua +++ b/test/unit/optionstr_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local to_cstr = helpers.to_cstr -local eq = helpers.eq +local to_cstr = t.to_cstr +local eq = t.eq -local optionstr = helpers.cimport('./src/nvim/optionstr.h') +local optionstr = t.cimport('./src/nvim/optionstr.h') local check_ff_value = function(ff) return optionstr.check_ff_value(to_cstr(ff)) diff --git a/test/unit/os/env_spec.lua b/test/unit/os/env_spec.lua index 310201b8c3..d0231b2e2b 100644 --- a/test/unit/os/env_spec.lua +++ b/test/unit/os/env_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) - -local cimport = helpers.cimport -local eq = helpers.eq -local neq = helpers.neq -local ffi = helpers.ffi -local cstr = helpers.cstr -local to_cstr = helpers.to_cstr -local NULL = helpers.NULL +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) + +local cimport = t.cimport +local eq = t.eq +local neq = t.neq +local ffi = t.ffi +local cstr = t.cstr +local to_cstr = t.to_cstr +local NULL = t.NULL local OK = 0 local cimp = cimport('./src/nvim/os/os.h') diff --git a/test/unit/os/fileio_spec.lua b/test/unit/os/fileio_spec.lua index 617141fd3a..d748a6d306 100644 --- a/test/unit/os/fileio_spec.lua +++ b/test/unit/os/fileio_spec.lua @@ -1,13 +1,13 @@ local uv = vim.uv -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) - -local eq = helpers.eq -local ffi = helpers.ffi -local cimport = helpers.cimport -local cppimport = helpers.cppimport -local mkdir = helpers.mkdir +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) + +local eq = t.eq +local ffi = t.ffi +local cimport = t.cimport +local cppimport = t.cppimport +local mkdir = t.mkdir local m = cimport('./src/nvim/os/os.h', './src/nvim/os/fileio.h') cppimport('fcntl.h') diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua index c15cd12fef..e866a1b5c3 100644 --- a/test/unit/os/fs_spec.lua +++ b/test/unit/os/fs_spec.lua @@ -1,22 +1,22 @@ local uv = vim.uv local bit = require('bit') -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) - -local cimport = helpers.cimport -local cppimport = helpers.cppimport -local internalize = helpers.internalize -local ok = helpers.ok -local eq = helpers.eq -local neq = helpers.neq -local ffi = helpers.ffi -local cstr = helpers.cstr -local to_cstr = helpers.to_cstr -local OK = helpers.OK -local FAIL = helpers.FAIL -local NULL = helpers.NULL -local mkdir = helpers.mkdir +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) + +local cimport = t.cimport +local cppimport = t.cppimport +local internalize = t.internalize +local ok = t.ok +local eq = t.eq +local neq = t.neq +local ffi = t.ffi +local cstr = t.cstr +local to_cstr = t.to_cstr +local OK = t.OK +local FAIL = t.FAIL +local NULL = t.NULL +local mkdir = t.mkdir local endswith = vim.endswith local NODE_NORMAL = 0 diff --git a/test/unit/os/shell_spec.lua b/test/unit/os/shell_spec.lua index 05f965585a..fd0a6336b0 100644 --- a/test/unit/os/shell_spec.lua +++ b/test/unit/os/shell_spec.lua @@ -1,14 +1,14 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) -local cimported = helpers.cimport( +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) +local cimported = t.cimport( './src/nvim/os/shell.h', './src/nvim/option_vars.h', './src/nvim/main.h', './src/nvim/memory.h' ) -local ffi, eq = helpers.ffi, helpers.eq -local intern = helpers.internalize -local to_cstr = helpers.to_cstr +local ffi, eq = t.ffi, t.eq +local intern = t.internalize +local to_cstr = t.to_cstr local NULL = ffi.cast('void *', 0) describe('shell functions', function() diff --git a/test/unit/os/users_spec.lua b/test/unit/os/users_spec.lua index 679e76fae1..cf81b25a44 100644 --- a/test/unit/os/users_spec.lua +++ b/test/unit/os/users_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local cimport = helpers.cimport -local eq = helpers.eq -local ffi = helpers.ffi -local lib = helpers.lib -local NULL = helpers.NULL -local OK = helpers.OK -local FAIL = helpers.FAIL +local cimport = t.cimport +local eq = t.eq +local ffi = t.ffi +local lib = t.lib +local NULL = t.NULL +local OK = t.OK +local FAIL = t.FAIL local users = cimport('./src/nvim/os/os.h', 'unistd.h') diff --git a/test/unit/path_spec.lua b/test/unit/path_spec.lua index c564ec119e..0c94201dfa 100644 --- a/test/unit/path_spec.lua +++ b/test/unit/path_spec.lua @@ -1,17 +1,17 @@ local uv = vim.uv -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) - -local cimport = helpers.cimport -local eq = helpers.eq -local neq = helpers.neq -local ffi = helpers.ffi -local cstr = helpers.cstr -local to_cstr = helpers.to_cstr -local NULL = helpers.NULL -local OK = helpers.OK -local FAIL = helpers.FAIL -local mkdir = helpers.mkdir +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) + +local cimport = t.cimport +local eq = t.eq +local neq = t.neq +local ffi = t.ffi +local cstr = t.cstr +local to_cstr = t.to_cstr +local NULL = t.NULL +local OK = t.OK +local FAIL = t.FAIL +local mkdir = t.mkdir cimport('string.h') local cimp = cimport('./src/nvim/os/os.h', './src/nvim/path.h') @@ -380,8 +380,8 @@ describe('path.c', function() return buf, result end - local function get_buf_len(s, t) - return math.max(string.len(s), string.len(t)) + 1 + local function get_buf_len(s, q) + return math.max(string.len(s), string.len(q)) + 1 end itp('fails if given filename is NULL', function() diff --git a/test/unit/preload.lua b/test/unit/preload.lua index c2d051d98a..896d07b9cd 100644 --- a/test/unit/preload.lua +++ b/test/unit/preload.lua @@ -2,5 +2,5 @@ -- Busted started doing this to help provide more isolation. See issue #62 -- for more information about this. local ffi = require('ffi') -local helpers = require('test.unit.helpers')(nil) +local t = require('test.unit.testutil')(nil) local preprocess = require('test.unit.preprocess') diff --git a/test/unit/preprocess.lua b/test/unit/preprocess.lua index 6294114e1e..8d481df0d0 100644 --- a/test/unit/preprocess.lua +++ b/test/unit/preprocess.lua @@ -2,10 +2,10 @@ -- windows, will probably need quite a bit of adjustment to run there. local ffi = require('ffi') -local global_helpers = require('test.helpers') +local global_t = require('test.testutil') -local argss_to_cmd = global_helpers.argss_to_cmd -local repeated_read_cmd = global_helpers.repeated_read_cmd +local argss_to_cmd = global_t.argss_to_cmd +local repeated_read_cmd = global_t.repeated_read_cmd --- @alias Compiler {path: string[], type: string} diff --git a/test/unit/profile_spec.lua b/test/unit/profile_spec.lua index c7dc7db189..79d32c3a69 100644 --- a/test/unit/profile_spec.lua +++ b/test/unit/profile_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local cimport = helpers.cimport -local ffi = helpers.ffi -local eq = helpers.eq -local neq = helpers.neq +local cimport = t.cimport +local ffi = t.ffi +local eq = t.eq +local neq = t.neq local prof = cimport('./src/nvim/profile.h') @@ -13,13 +13,13 @@ local function split(inputstr, sep) sep = '%s' end - local t, i = {}, 1 + local q, i = {}, 1 for str in string.gmatch(inputstr, '([^' .. sep .. ']+)') do - t[i] = str + q[i] = str i = i + 1 end - return t + return q end local function trim(s) @@ -72,8 +72,8 @@ describe('profiling related functions', function() local function profile_start() return prof.profile_start() end - local function profile_end(t) - return prof.profile_end(t) + local function profile_end(q) + return prof.profile_end(q) end local function profile_zero() return prof.profile_zero() @@ -81,8 +81,8 @@ describe('profiling related functions', function() local function profile_setlimit(ms) return prof.profile_setlimit(ms) end - local function profile_passed_limit(t) - return prof.profile_passed_limit(t) + local function profile_passed_limit(q) + return prof.profile_passed_limit(q) end local function profile_add(t1, t2) return prof.profile_add(t1, t2) @@ -90,8 +90,8 @@ describe('profiling related functions', function() local function profile_sub(t1, t2) return prof.profile_sub(t1, t2) end - local function profile_divide(t, cnt) - return prof.profile_divide(t, cnt) + local function profile_divide(q, cnt) + return prof.profile_divide(q, cnt) end local function profile_cmp(t1, t2) return prof.profile_cmp(t1, t2) @@ -99,12 +99,12 @@ describe('profiling related functions', function() local function profile_equal(t1, t2) return prof.profile_equal(t1, t2) end - local function profile_msg(t) - return ffi.string(prof.profile_msg(t)) + local function profile_msg(q) + return ffi.string(prof.profile_msg(q)) end - local function toseconds(t) -- luacheck: ignore - local str = trim(profile_msg(t)) + local function toseconds(q) -- luacheck: ignore + local str = trim(profile_msg(q)) local spl = split(str, '.') local s, us = spl[1], spl[2] return tonumber(s) + tonumber(us) / 1000000 diff --git a/test/unit/rbuffer_spec.lua b/test/unit/rbuffer_spec.lua index 328e5b93da..4b2d64cd48 100644 --- a/test/unit/rbuffer_spec.lua +++ b/test/unit/rbuffer_spec.lua @@ -1,13 +1,13 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local eq = helpers.eq -local ffi = helpers.ffi -local cstr = helpers.cstr -local to_cstr = helpers.to_cstr -local child_call_once = helpers.child_call_once +local eq = t.eq +local ffi = t.ffi +local cstr = t.cstr +local to_cstr = t.to_cstr +local child_call_once = t.child_call_once -local rbuffer = helpers.cimport('./test/unit/fixtures/rbuffer.h') +local rbuffer = t.cimport('./test/unit/fixtures/rbuffer.h') describe('rbuffer functions', function() local capacity = 16 diff --git a/test/unit/search_spec.lua b/test/unit/search_spec.lua index efe49f974a..4572beaae0 100644 --- a/test/unit/search_spec.lua +++ b/test/unit/search_spec.lua @@ -1,12 +1,12 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local to_cstr = helpers.to_cstr -local eq = helpers.eq +local to_cstr = t.to_cstr +local eq = t.eq -local search = helpers.cimport('./src/nvim/search.h') -local globals = helpers.cimport('./src/nvim/globals.h') -local ffi = helpers.ffi +local search = t.cimport('./src/nvim/search.h') +local globals = t.cimport('./src/nvim/globals.h') +local ffi = t.ffi itp('pat_has_uppercase', function() -- works on empty string @@ -42,7 +42,7 @@ describe('search_regcomp', function() end local get_search_pat = function() - return helpers.internalize(search.get_search_pat()) + return t.internalize(search.get_search_pat()) end itp('accepts regexp pattern with invalid utf', function() diff --git a/test/unit/statusline_spec.lua b/test/unit/statusline_spec.lua index 83ba4176c5..41afa3c897 100644 --- a/test/unit/statusline_spec.lua +++ b/test/unit/statusline_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local to_cstr = helpers.to_cstr -local get_str = helpers.ffi.string -local eq = helpers.eq -local NULL = helpers.NULL +local to_cstr = t.to_cstr +local get_str = t.ffi.string +local eq = t.eq +local NULL = t.NULL -local buffer = helpers.cimport('./src/nvim/buffer.h') -local globals = helpers.cimport('./src/nvim/globals.h') -local stl = helpers.cimport('./src/nvim/statusline.h') -local grid = helpers.cimport('./src/nvim/grid.h') +local buffer = t.cimport('./src/nvim/buffer.h') +local globals = t.cimport('./src/nvim/globals.h') +local stl = t.cimport('./src/nvim/statusline.h') +local grid = t.cimport('./src/nvim/grid.h') describe('build_stl_str_hl', function() local buffer_byte_size = 100 diff --git a/test/unit/strings_spec.lua b/test/unit/strings_spec.lua index eea669c964..e686998e84 100644 --- a/test/unit/strings_spec.lua +++ b/test/unit/strings_spec.lua @@ -1,10 +1,10 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local cimport = helpers.cimport -local eq = helpers.eq -local ffi = helpers.ffi -local to_cstr = helpers.to_cstr +local cimport = t.cimport +local eq = t.eq +local ffi = t.ffi +local to_cstr = t.to_cstr local strings = cimport('stdlib.h', './src/nvim/strings.h', './src/nvim/memory.h') @@ -261,7 +261,7 @@ end) describe('reverse_text', function() local reverse_text = function(str) - return helpers.internalize(strings.reverse_text(to_cstr(str))) + return t.internalize(strings.reverse_text(to_cstr(str))) end itp('handles empty string', function() diff --git a/test/unit/tempfile_spec.lua b/test/unit/tempfile_spec.lua index bb0e56d640..3308eaebb2 100644 --- a/test/unit/tempfile_spec.lua +++ b/test/unit/tempfile_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) -local eq = helpers.eq -local neq = helpers.neq -local cimport = helpers.cimport -local child_call_once = helpers.child_call_once -local child_cleanup_once = helpers.child_cleanup_once +local eq = t.eq +local neq = t.neq +local cimport = t.cimport +local child_call_once = t.child_call_once +local child_cleanup_once = t.child_cleanup_once local lib = cimport('./src/nvim/os/os.h', './src/nvim/fileio.h') @@ -19,7 +19,7 @@ describe('tempfile related functions', function() end) local vim_gettempdir = function() - return helpers.ffi.string(lib.vim_gettempdir()) + return t.ffi.string(lib.vim_gettempdir()) end describe('vim_gettempdir', function() @@ -28,7 +28,7 @@ describe('tempfile related functions', function() assert.True(dir ~= nil and dir:len() > 0) -- os_file_is_writable returns 2 for a directory which we have rights -- to write into. - eq(2, lib.os_file_is_writable(helpers.to_cstr(dir))) + eq(2, lib.os_file_is_writable(t.to_cstr(dir))) for entry in vim.fs.dir(dir) do assert.True(entry == '.' or entry == '..') end @@ -41,7 +41,7 @@ describe('tempfile related functions', function() describe('vim_tempname', function() local vim_tempname = function() - return helpers.ffi.string(lib.vim_tempname()) + return t.ffi.string(lib.vim_tempname()) end itp('generate name of non-existing file', function() diff --git a/test/unit/testtest_spec.lua b/test/unit/testtest_spec.lua index d2f3632b6f..79f29f4e54 100644 --- a/test/unit/testtest_spec.lua +++ b/test/unit/testtest_spec.lua @@ -1,9 +1,9 @@ -local helpers = require('test.unit.helpers')(after_each) +local t = require('test.unit.testutil')(after_each) local assert = require('luassert') -local itp = helpers.gen_itp(it) +local itp = t.gen_itp(it) -local sc = helpers.sc +local sc = t.sc -- All of the below tests must fail. Check how exactly they fail. if os.getenv('NVIM_TEST_RUN_TESTTEST') ~= '1' then diff --git a/test/unit/helpers.lua b/test/unit/testutil.lua index be48f777e8..c1ba1f6e97 100644 --- a/test/unit/helpers.lua +++ b/test/unit/testutil.lua @@ -2,16 +2,16 @@ local ffi = require('ffi') local formatc = require('test.unit.formatc') local Set = require('test.unit.set') local Preprocess = require('test.unit.preprocess') -local global_helpers = require('test.helpers') -local paths = global_helpers.paths +local t_global = require('test.testutil') +local paths = t_global.paths local assert = require('luassert') local say = require('say') -local check_cores = global_helpers.check_cores -local dedent = global_helpers.dedent -local neq = global_helpers.neq +local check_cores = t_global.check_cores +local dedent = t_global.dedent +local neq = t_global.neq local map = vim.tbl_map -local eq = global_helpers.eq +local eq = t_global.eq local trim = vim.trim -- add some standard header locations @@ -873,7 +873,7 @@ local function is_asan() end end ---- @class test.unit.helpers.module +--- @class test.unit.testutil.module local module = { cimport = cimport, cppimport = cppimport, @@ -903,8 +903,8 @@ local module = { debug_log = debug_log, is_asan = is_asan, } ---- @class test.unit.helpers: test.unit.helpers.module, test.helpers -module = vim.tbl_extend('error', module, global_helpers) +--- @class test.unit.testutil: test.unit.testutil.module, test.testutil +module = vim.tbl_extend('error', module, t_global) return function() return module diff --git a/test/unit/undo_spec.lua b/test/unit/undo_spec.lua index 0e2f38a8c8..847ac7789a 100644 --- a/test/unit/undo_spec.lua +++ b/test/unit/undo_spec.lua @@ -1,15 +1,15 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) local uv = vim.uv -local child_call_once = helpers.child_call_once +local child_call_once = t.child_call_once local sleep = uv.sleep -local ffi = helpers.ffi -local cimport = helpers.cimport -local to_cstr = helpers.to_cstr -local neq = helpers.neq -local eq = helpers.eq -local mkdir = helpers.mkdir +local ffi = t.ffi +local cimport = t.cimport +local to_cstr = t.to_cstr +local neq = t.neq +local eq = t.eq +local mkdir = t.mkdir local options = cimport('./src/nvim/option_vars.h') local undo = cimport('./src/nvim/undo.h') @@ -151,12 +151,12 @@ describe('u_write_undo', function() local file_contents = 'testing permissions' -- Write a text file where the undofile should go local correct_name = ffi.string(undo.u_get_undo_file_name(file_buffer.b_ffname, false)) - helpers.write_file(correct_name, file_contents, true, false) + t.write_file(correct_name, file_contents, true, false) -- Call with `forceit`. u_write_undo(correct_name, true, file_buffer, buffer_hash) - local undo_file_contents = helpers.read_file(correct_name) + local undo_file_contents = t.read_file(correct_name) neq(file_contents, undo_file_contents) local success, deletion_err = os.remove(correct_name) -- delete the file now that we're done with it. diff --git a/test/unit/viml/expressions/lexer_spec.lua b/test/unit/viml/expressions/lexer_spec.lua index 96052a5ce1..9b2ad0a84b 100644 --- a/test/unit/viml/expressions/lexer_spec.lua +++ b/test/unit/viml/expressions/lexer_spec.lua @@ -1,20 +1,20 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) -local viml_helpers = require('test.unit.viml.helpers') - -local child_call_once = helpers.child_call_once -local conv_enum = helpers.conv_enum -local cimport = helpers.cimport -local ffi = helpers.ffi -local eq = helpers.eq -local shallowcopy = helpers.shallowcopy -local intchar2lua = helpers.intchar2lua - -local conv_ccs = viml_helpers.conv_ccs -local new_pstate = viml_helpers.new_pstate -local conv_cmp_type = viml_helpers.conv_cmp_type -local pstate_set_str = viml_helpers.pstate_set_str -local conv_expr_asgn_type = viml_helpers.conv_expr_asgn_type +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) +local t_viml = require('test.unit.viml.testutil') + +local child_call_once = t.child_call_once +local conv_enum = t.conv_enum +local cimport = t.cimport +local ffi = t.ffi +local eq = t.eq +local shallowcopy = t.shallowcopy +local intchar2lua = t.intchar2lua + +local conv_ccs = t_viml.conv_ccs +local new_pstate = t_viml.new_pstate +local conv_cmp_type = t_viml.conv_cmp_type +local pstate_set_str = t_viml.pstate_set_str +local conv_expr_asgn_type = t_viml.conv_expr_asgn_type local lib = cimport('./src/nvim/viml/parser/expressions.h') diff --git a/test/unit/viml/expressions/parser_spec.lua b/test/unit/viml/expressions/parser_spec.lua index c7d3f8532f..74f2a120bf 100644 --- a/test/unit/viml/expressions/parser_spec.lua +++ b/test/unit/viml/expressions/parser_spec.lua @@ -1,29 +1,29 @@ -local helpers = require('test.unit.helpers')(after_each) -local itp = helpers.gen_itp(it) -local viml_helpers = require('test.unit.viml.helpers') +local t = require('test.unit.testutil')(after_each) +local itp = t.gen_itp(it) +local t_viml = require('test.unit.viml.testutil') -local make_enum_conv_tab = helpers.make_enum_conv_tab -local child_call_once = helpers.child_call_once -local alloc_log_new = helpers.alloc_log_new -local kvi_destroy = helpers.kvi_destroy -local conv_enum = helpers.conv_enum -local debug_log = helpers.debug_log -local ptr2key = helpers.ptr2key -local cimport = helpers.cimport -local ffi = helpers.ffi -local neq = helpers.neq -local eq = helpers.eq -local mergedicts_copy = helpers.mergedicts_copy +local make_enum_conv_tab = t.make_enum_conv_tab +local child_call_once = t.child_call_once +local alloc_log_new = t.alloc_log_new +local kvi_destroy = t.kvi_destroy +local conv_enum = t.conv_enum +local debug_log = t.debug_log +local ptr2key = t.ptr2key +local cimport = t.cimport +local ffi = t.ffi +local neq = t.neq +local eq = t.eq +local mergedicts_copy = t.mergedicts_copy local format_string = require('test.format_string').format_string local format_luav = require('test.format_string').format_luav -local intchar2lua = helpers.intchar2lua -local dictdiff = helpers.dictdiff +local intchar2lua = t.intchar2lua +local dictdiff = t.dictdiff -local conv_ccs = viml_helpers.conv_ccs -local new_pstate = viml_helpers.new_pstate -local conv_cmp_type = viml_helpers.conv_cmp_type -local pstate_set_str = viml_helpers.pstate_set_str -local conv_expr_asgn_type = viml_helpers.conv_expr_asgn_type +local conv_ccs = t_viml.conv_ccs +local new_pstate = t_viml.new_pstate +local conv_cmp_type = t_viml.conv_cmp_type +local pstate_set_str = t_viml.pstate_set_str +local conv_expr_asgn_type = t_viml.conv_expr_asgn_type local lib = cimport('./src/nvim/viml/parser/expressions.h', './src/nvim/syntax.h') diff --git a/test/unit/viml/helpers.lua b/test/unit/viml/testutil.lua index 92661e3027..7046cedb47 100644 --- a/test/unit/viml/helpers.lua +++ b/test/unit/viml/testutil.lua @@ -1,11 +1,11 @@ -local helpers = require('test.unit.helpers')(nil) +local t = require('test.unit.testutil')(nil) -local ffi = helpers.ffi -local cimport = helpers.cimport -local kvi_new = helpers.kvi_new -local kvi_init = helpers.kvi_init -local conv_enum = helpers.conv_enum -local make_enum_conv_tab = helpers.make_enum_conv_tab +local ffi = t.ffi +local cimport = t.cimport +local kvi_new = t.kvi_new +local kvi_init = t.kvi_init +local conv_enum = t.conv_enum +local make_enum_conv_tab = t.make_enum_conv_tab local lib = cimport('./src/nvim/viml/parser/expressions.h') |