paste: fixup tests

This commit is contained in:
Justin M. Keyes
2019-08-19 01:01:40 +02:00
parent 4389401a7c
commit abd55be19a
2 changed files with 7 additions and 12 deletions

View File

@@ -96,7 +96,7 @@ end
-- Default paste function. -- Default paste function.
local function _paste(data) local function _paste(data)
-- local eof = (data == {''}) -- local eof = (data == {''})
local curline = vim.api.nvim_call_function('line', {'.'}) - 1 local curline = vim.api.nvim_call_function('line', {'.'})
vim.api.nvim_buf_set_lines( vim.api.nvim_buf_set_lines(
0, 0,
curline, curline,

View File

@@ -146,8 +146,7 @@ describe('TUI', function()
]], attrs) ]], attrs)
end) end)
it('bracketed Paste', function() it('paste: Insert mode', function()
-- Pasting can be really slow in the TUI, specially in ASAN.
feed_data('i\027[200~') feed_data('i\027[200~')
screen:expect([[ screen:expect([[
{1: } | {1: } |
@@ -160,8 +159,8 @@ describe('TUI', function()
]]) ]])
feed_data('pasted from terminal') feed_data('pasted from terminal')
screen:expect([[ screen:expect([[
pasted from terminal{1: } |
| |
pasted from terminal{1: } |
{4:~ }| {4:~ }|
{4:~ }| {4:~ }|
{5:[No Name] [+] }| {5:[No Name] [+] }|
@@ -171,8 +170,8 @@ describe('TUI', function()
feed_data('\027[201~') -- End paste. feed_data('\027[201~') -- End paste.
feed_data('\027\000') -- ESC: go to Normal mode. feed_data('\027\000') -- ESC: go to Normal mode.
screen:expect([[ screen:expect([[
pasted from termina{1:l} |
| |
pasted from termina{1:l} |
{4:~ }| {4:~ }|
{4:~ }| {4:~ }|
{5:[No Name] [+] }| {5:[No Name] [+] }|
@@ -181,24 +180,20 @@ describe('TUI', function()
]]) ]])
end) end)
it('handles pasting a specific amount of text', function() it('pasting a specific amount of text #10311', function()
-- Need extra time for this test, specially in ASAN.
screen.timeout = 60000
feed_data('i\027[200~'..string.rep('z', 64)..'\027[201~') feed_data('i\027[200~'..string.rep('z', 64)..'\027[201~')
screen:expect([[ screen:expect([[
|
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz| zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz|
zzzzzzzzzzzzzz{1: } | zzzzzzzzzzzzzz{1: } |
{4:~ }| {4:~ }|
{4:~ }|
{5:[No Name] [+] }| {5:[No Name] [+] }|
{3:-- INSERT --} | {3:-- INSERT --} |
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
end) end)
it('can handle arbitrarily long bursts of input', function() it('big burst of input (bracketed paste)', function()
-- Need extra time for this test, specially in ASAN.
screen.timeout = 60000
feed_command('set ruler') feed_command('set ruler')
local t = {} local t = {}
for i = 1, 3000 do for i = 1, 3000 do