neovim/test/functional/ex_cmds/sign_spec.lua
Justin M. Keyes c095f83116 api: change nvim_command_output behavior
Implement nvim_command_output with `execute({cmd},"silent")`.

Behavior changes:
- does not provoke any hit-enter prompt
- no longer prepends a newline char
- does not capture some noise (like the "[New File]" message, see the
  change to tabnewentered_spec.lua)

Technically ("bug-for-bug") this a breaking change.  But the previous
behavior of nvim_command_output meant that it probably wasn't used for
anything outside of tests.

Also remove the undocumented `v:command_output` variable which was
a hack introduced only for the purposes of nvim_command_output.

closes #7726
2018-01-10 23:45:44 +01:00

25 lines
1.1 KiB
Lua

local helpers = require('test.functional.helpers')(after_each)
local clear, nvim, eq = helpers.clear, helpers.nvim, helpers.eq
describe('sign', function()
before_each(clear)
describe('unplace {id}', function()
describe('without specifying buffer', function()
it('deletes the sign from all buffers', function()
-- place a sign with id 34 to first buffer
nvim('command', 'sign define Foo text=+ texthl=Delimiter linehl=Comment')
local buf1 = nvim('eval', 'bufnr("%")')
nvim('command', 'sign place 34 line=3 name=Foo buffer='..buf1)
-- create a second buffer and place the sign on it as well
nvim('command', 'new')
local buf2 = nvim('eval', 'bufnr("%")')
nvim('command', 'sign place 34 line=3 name=Foo buffer='..buf2)
-- now unplace without specifying a buffer
nvim('command', 'sign unplace 34')
eq("--- Signs ---\n", nvim('command_output', 'sign place buffer='..buf1))
eq("--- Signs ---\n", nvim('command_output', 'sign place buffer='..buf2))
end)
end)
end)
end)