mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
test/clipboard: split unrelated subtests
This commit is contained in:
parent
73bf0551f8
commit
638ceea092
@ -8,6 +8,7 @@ local nvim, run, stop, restart = helpers.nvim, helpers.run, helpers.stop, helper
|
||||
local function reset()
|
||||
clear()
|
||||
execute('let &rtp = "test/functional/clipboard,".&rtp')
|
||||
execute('call getreg("*")') -- force load of provider
|
||||
end
|
||||
|
||||
local function basic_register_test()
|
||||
@ -62,7 +63,8 @@ local function basic_register_test()
|
||||
end
|
||||
|
||||
describe('clipboard usage', function()
|
||||
setup(reset)
|
||||
before_each(reset)
|
||||
|
||||
it("works", function()
|
||||
basic_register_test()
|
||||
|
||||
@ -71,9 +73,9 @@ describe('clipboard usage', function()
|
||||
feed('^"*dwdw"*P')
|
||||
expect('some ')
|
||||
eq({'some '}, eval("g:test_clip['*']"))
|
||||
reset()
|
||||
end)
|
||||
|
||||
-- "* and "+ should be independent when the provider supports it
|
||||
it('supports separate "* and "+ when the provider supports it', function()
|
||||
insert([[
|
||||
text:
|
||||
first line
|
||||
@ -89,9 +91,9 @@ describe('clipboard usage', function()
|
||||
-- linewise selection should be encoded as an extra newline
|
||||
eq({'third line', ''}, eval("g:test_clip['+']"))
|
||||
eq({'secound line', ''}, eval("g:test_clip['*']"))
|
||||
reset()
|
||||
end)
|
||||
|
||||
-- handle null bytes
|
||||
it('handles null bytes', function()
|
||||
insert("some\022000text\n\022000very binary\022000")
|
||||
feed('"*y-+"*p')
|
||||
eq({'some\ntext', '\nvery binary\n',''}, eval("g:test_clip['*']"))
|
||||
@ -100,22 +102,21 @@ describe('clipboard usage', function()
|
||||
-- test getreg/getregtype
|
||||
eq('some\ntext\n\nvery binary\n\n', eval("getreg('*', 1)"))
|
||||
eq("V", eval("getregtype('*')"))
|
||||
reset()
|
||||
end)
|
||||
|
||||
-- blockwise paste
|
||||
it('support blockwise operations', function()
|
||||
insert([[
|
||||
much
|
||||
text]])
|
||||
feed('"*yy') -- force load of provider
|
||||
execute("let g:test_clip['*'] = [['very','block'],'b']")
|
||||
feed('gg"*P')
|
||||
expect([[
|
||||
very much
|
||||
blocktext]])
|
||||
eq("\0225", eval("getregtype('*')"))
|
||||
reset()
|
||||
end)
|
||||
|
||||
-- test setreg
|
||||
it('supports setreg', function()
|
||||
execute('call setreg("*", "setted\\ntext", "c")')
|
||||
execute('call setreg("+", "explicitly\\nlines", "l")')
|
||||
feed('"+P"*p')
|
||||
@ -124,9 +125,9 @@ describe('clipboard usage', function()
|
||||
textxplicitly
|
||||
lines
|
||||
]])
|
||||
reset()
|
||||
end)
|
||||
|
||||
-- test let @+ (issue #1427)
|
||||
it('supports let @+ (issue #1427)', function()
|
||||
execute("let @+ = 'some'")
|
||||
execute("let @* = ' other stuff'")
|
||||
eq({'some'}, eval("g:test_clip['+']"))
|
||||
@ -136,8 +137,9 @@ describe('clipboard usage', function()
|
||||
execute("let @+ .= ' more'")
|
||||
feed('dd"+p')
|
||||
expect('some more')
|
||||
reset()
|
||||
end)
|
||||
|
||||
it('supports clipboard=unnamed', function()
|
||||
-- the basic behavior of unnamed register should be the same
|
||||
-- even when handled by clipboard provider
|
||||
execute('set clipboard=unnamed')
|
||||
@ -155,7 +157,6 @@ describe('clipboard usage', function()
|
||||
expect([[
|
||||
words
|
||||
linewise stuff]])
|
||||
reset()
|
||||
|
||||
end)
|
||||
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user