test: unit (#97)
* refactor(utils): remove unused function * fix(installer): actually pass what should be passed * docs: add explanation comment * test: add utils * refactor(utils): flatten the dir of files * remove .luarc
This commit is contained in:
parent
9aa0038125
commit
7af08c9780
8 changed files with 39 additions and 26 deletions
|
|
@ -2,18 +2,6 @@ local c = require "gopher.config"
|
|||
local log = require "gopher._utils.log"
|
||||
local utils = {}
|
||||
|
||||
---@param msg string
|
||||
---@param lvl? number
|
||||
function utils.deferred_notify(msg, lvl)
|
||||
lvl = lvl or vim.log.levels.INFO
|
||||
vim.defer_fn(function()
|
||||
vim.notify(msg, lvl, {
|
||||
title = c.___plugin_name,
|
||||
})
|
||||
log.debug(msg)
|
||||
end, 0)
|
||||
end
|
||||
|
||||
---@param msg string
|
||||
---@param lvl? number
|
||||
function utils.notify(msg, lvl)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
local log = require "gopher._utils.log"
|
||||
local tags = require "gopher.struct_tags"
|
||||
local tests = require "gopher.gotests"
|
||||
local gocmd = require("gopher._utils.runner.gocmd").run
|
||||
local gocmd = require("gopher._utils.gocmd").run
|
||||
local gopher = {}
|
||||
|
||||
---@toc_entry Setup
|
||||
|
|
|
|||
|
|
@ -15,12 +15,17 @@ local urls = {
|
|||
---@param url string
|
||||
local function handle_intall_exit(opt, url)
|
||||
if opt.code ~= 0 then
|
||||
u.deferred_notify("go install failed: " .. url)
|
||||
vim.schedule(function()
|
||||
u.notify("go install failed: " .. url)
|
||||
end)
|
||||
|
||||
log.error("go install failed:", "url", url, "opt", vim.inspect(opt))
|
||||
return
|
||||
end
|
||||
|
||||
u.deferred_notify("go install-ed: " .. url)
|
||||
vim.schedule(function()
|
||||
u.notify("go install-ed: " .. url)
|
||||
end)
|
||||
end
|
||||
|
||||
---@param url string
|
||||
|
|
@ -40,7 +45,7 @@ end
|
|||
---@param opts? {sync:boolean}
|
||||
function installer.install_deps(opts)
|
||||
opts = opts or {}
|
||||
for url, _ in pairs(urls) do
|
||||
for _, url in pairs(urls) do
|
||||
if opts.sync then
|
||||
install_sync(url)
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue