mirror of
https://github.com/lewis6991/gitsigns.nvim
synced 2025-02-16 04:06:50 +00:00
test: cleanup setup
This commit is contained in:
parent
b018a2b139
commit
0828f7e4a7
@ -315,14 +315,7 @@ describe('gitsigns', function()
|
||||
describe('on_attach()', function()
|
||||
it('can prevent attaching to a buffer', function()
|
||||
setup_test_repo{no_add=true}
|
||||
|
||||
-- Functions can't be serialized over rpc so need to setup config
|
||||
-- remotely
|
||||
setup_gitsigns(config, [[
|
||||
config.on_attach = function()
|
||||
return false
|
||||
end
|
||||
]])
|
||||
setup_gitsigns(config, true)
|
||||
|
||||
edit(test_file)
|
||||
match_debug_messages {
|
||||
|
@ -201,10 +201,9 @@ function M.match_debug_messages(spec)
|
||||
end)
|
||||
end
|
||||
|
||||
function M.setup_gitsigns(config, extra)
|
||||
extra = extra or ''
|
||||
function M.setup_gitsigns(config, on_attach)
|
||||
exec_lua([[
|
||||
local config = ...
|
||||
local config, on_attach = ...
|
||||
if config and config.on_attach then
|
||||
local maps = config.on_attach
|
||||
config.on_attach = function(bufnr)
|
||||
@ -213,9 +212,13 @@ function M.setup_gitsigns(config, extra)
|
||||
end
|
||||
end
|
||||
end
|
||||
]]..extra..[[
|
||||
if on_attach then
|
||||
config.on_attach = function()
|
||||
return false
|
||||
end
|
||||
end
|
||||
require('gitsigns').setup(...)
|
||||
]], config)
|
||||
]], config, on_attach)
|
||||
M.expectf(function()
|
||||
return exec_lua[[return require'gitsigns'._setup_done == true]]
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user