paste: test

This commit is contained in:
Justin M. Keyes
2019-08-20 16:55:26 +02:00
parent 5a2894d677
commit d303790ee7

View File

@@ -29,7 +29,8 @@ describe('TUI', function()
before_each(function() before_each(function()
clear() clear()
screen = thelpers.screen_setup(0, '["'..nvim_prog screen = thelpers.screen_setup(0, '["'..nvim_prog
..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile noshowcmd noruler undodir=. directory=. viewdir=. backupdir=."]') ..'", "-u", "NONE", "-i", "NONE", "--cmd", "'
..nvim_set..' laststatus=2 background=dark'..'"]')
screen:expect([[ screen:expect([[
{1: } | {1: } |
{4:~ }| {4:~ }|
@@ -151,6 +152,7 @@ describe('TUI', function()
end) end)
it('paste: Insert mode', function() it('paste: Insert mode', function()
-- "bracketed paste"
feed_data('i\027[200~') feed_data('i\027[200~')
screen:expect([[ screen:expect([[
{1: } | {1: } |
@@ -184,26 +186,30 @@ describe('TUI', function()
]]) ]])
end) end)
it('pasting a specific amount of text #10311', function() it('paste: exactly 64 bytes #10311', function()
-- "bracketed paste"
feed_data('i\027[200~'..string.rep('z', 64)..'\027[201~') feed_data('i\027[200~'..string.rep('z', 64)..'\027[201~')
feed_data('\003') -- CTRL-C
screen:expect([[ screen:expect([[
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz| zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz|
zzzzzzzzzzzzzz{1: } | zzzzzzzzzzzzz{1:z} |
{4:~ }| {4:~ }|
{4:~ }| {4:~ }|
{5:[No Name] [+] }| {5:[No Name] [+] }|
{3:-- INSERT --} | |
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
end) end)
it('big burst of input (bracketed paste)', function() it('paste: big burst of input', function()
feed_command('set ruler') feed_command('set ruler')
local t = {} local t = {}
for i = 1, 3000 do for i = 1, 3000 do
t[i] = 'item ' .. tostring(i) t[i] = 'item ' .. tostring(i)
end end
feed_data('i\027[200~'..table.concat(t, '\n')..'\027[201~') local expected = table.concat(t, '\n')
-- "bracketed paste"
feed_data('i\027[200~'..expected..'\027[201~')
screen:expect([[ screen:expect([[
item 2997 | item 2997 |
item 2998 | item 2998 |
@@ -231,8 +237,8 @@ describe('TUI', function()
screen:expect{grid=[[ screen:expect{grid=[[
| |
pasted from terminal (1) | pasted from terminal (1) |
{6:^[}[200~{1: } | {6:^[}[200~ |
{4:~ }| {1: } |
{5:[No Name] [+] }| {5:[No Name] [+] }|
{3:-- INSERT --} | {3:-- INSERT --} |
{3:-- TERMINAL --} | {3:-- TERMINAL --} |