gopher.nvim/lua/gopher/_utils/init.lua
Smirnov Oleksandr 5f8466d043
run tests independent of user nvim setup (#39)
* chore(lua_ls): now lua_ls knows about testing functions

* spec: change way how tests srtuctured

* test(config): refactor tests

* test: utils

* refactor(utils): remove not used function

* chore(ci): add test runner

* chore(ci): remove taskfile from deps

* fix: now it works
2023-07-21 02:57:46 +03:00

28 lines
537 B
Lua

local utils = {}
---@param t table
---@return boolean
function utils.is_tbl_empty(t)
if t == nil then
return true
end
return next(t) == nil
end
---@param msg string
---@param lvl any
function utils.deferred_notify(msg, lvl)
vim.defer_fn(function()
vim.notify(msg, lvl)
end, 0)
end
-- safe require
---@param module string module name
function utils.sreq(module)
local ok, m = pcall(require, module)
assert(ok, string.format("gopher.nvim dependency error: %s not installed", module))
return m
end
return utils