aboutsummaryrefslogtreecommitdiff
path: root/test/unit/api
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2024-04-08 11:03:20 +0200
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2024-04-08 22:51:00 +0200
commit7035125b2b26aa68fcfb7cda39377ac79926a0f9 (patch)
treed194a3556a367b42505f9e7d26637e7cb3674928 /test/unit/api
parent978962f9a00ce75216d2c36b79397ef3d2b54096 (diff)
downloadrneovim-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/api')
-rw-r--r--test/unit/api/private_helpers_spec.lua42
-rw-r--r--test/unit/api/testutil.lua (renamed from test/unit/api/helpers.lua)31
2 files changed, 35 insertions, 38 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