Add plenary tests to neovim check
parent
306c7ed92d
commit
c2db3f7758
2
Makefile
2
Makefile
|
@ -314,6 +314,8 @@ check_neovim: check_os
|
|||
@nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerInstall'
|
||||
@echo "Doing a basic neovim startup and quit"
|
||||
@nvim --headless -c 'set display-=msgsep' -c 'quitall'
|
||||
@echo "Running plenary tests"
|
||||
@nvim --headless -c 'PlenaryBustedDirectory symlinks/config/nvim/lua/tests'
|
||||
|
||||
.PHONY: run_tests
|
||||
run_tests: check_os
|
||||
|
|
|
@ -13,3 +13,7 @@ vim.keymap.set("n", "<Leader>tf", ":TestFile<CR>", opts)
|
|||
vim.keymap.set("n", "<Leader>ts", ":TestSuite<CR>", opts)
|
||||
vim.keymap.set("n", "<Leader>tl", ":TestLast<CR>", opts)
|
||||
vim.keymap.set("n", "<Leader>tg", ":TestVisit<CR>", opts)
|
||||
|
||||
vim.api.nvim_create_user_command("PlenaryTestFile", function()
|
||||
require("plenary.test_harness").test_directory(vim.fn.expand("%:p"))
|
||||
end, {})
|
||||
|
|
|
@ -57,7 +57,7 @@ end
|
|||
|
||||
-- Copies current branches PR url to system clipboard
|
||||
function M.copy_pr_url(...)
|
||||
vim.cmd('let @+ = "' .. get_pr_url(...) .. '"')
|
||||
vim.fn.setreg("+", get_pr_url(...))
|
||||
end
|
||||
|
||||
-- Opens current banches PR url in default browser
|
||||
|
@ -77,4 +77,9 @@ function M.checkout_branch(branch)
|
|||
vim.cmd("Git checkout " .. branch)
|
||||
end
|
||||
|
||||
-- Deletes a branch
|
||||
function M.delete_branch(branch)
|
||||
vim.cmd("Git branch -d " .. branch)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
local fugitive_extensions = require("esensar.fugitive_extensions")
|
||||
|
||||
describe("fugitive extensions:", function()
|
||||
describe("copy_pr_url", function()
|
||||
before_each(function()
|
||||
fugitive_extensions.create_branch("test")
|
||||
end)
|
||||
after_each(function()
|
||||
fugitive_extensions.checkout_branch("main")
|
||||
fugitive_extensions.delete_branch("test")
|
||||
end)
|
||||
it("copies PR url to main branch by default", function()
|
||||
fugitive_extensions.copy_pr_url()
|
||||
assert.are.same("https://github.com/esensar/dotfiles/compare/test?expand=1", vim.fn.getreg("+"))
|
||||
end)
|
||||
it("copies PR url to passed branch", function()
|
||||
fugitive_extensions.copy_pr_url("dev")
|
||||
assert.are.same("https://github.com/esensar/dotfiles/compare/dev...test?expand=1", vim.fn.getreg("+"))
|
||||
end)
|
||||
end)
|
||||
end)
|
Loading…
Reference in New Issue