diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/api/vim_spec.lua | 29 | ||||
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 26 |
2 files changed, 50 insertions, 5 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 6f7661dd76..02e83c4d58 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -518,6 +518,35 @@ describe('API', function() line 3]]) eq({0,3,6,0}, funcs.getpos('.')) end) + + it('allows block width', function() + -- behave consistently with setreg(); support "\022{NUM}" return by getregtype() + meths.put({'line 1','line 2','line 3'}, 'l', false, false) + expect([[ + line 1 + line 2 + line 3 + ]]) + + -- larger width create spaces + meths.put({'a', 'bc'}, 'b3', false, false) + expect([[ + a line 1 + bc line 2 + line 3 + ]]) + -- smaller width is ignored + meths.put({'xxx', 'yyy'}, '\0221', false, true) + expect([[ + xxxa line 1 + yyybc line 2 + line 3 + ]]) + eq({false, "Invalid type: 'bx'"}, + meth_pcall(meths.put, {'xxx', 'yyy'}, 'bx', false, true)) + eq({false, "Invalid type: 'b3x'"}, + meth_pcall(meths.put, {'xxx', 'yyy'}, 'b3x', false, true)) + end) end) describe('nvim_strwidth', function() diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 8d8c0e3647..07c91d43e1 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -352,15 +352,23 @@ describe('TUI', function() ]]} -- Start pasting... feed_data('\027[200~line 1\nline 2\n') - expect_child_buf_lines({'foo',''}) - screen:expect{any='paste: Error executing lua'} + screen:expect{grid=[[ + foo | + | + {5: }| + {8:paste: Error executing lua: [string "<nvim>"]:2: f}| + {8:ake fail} | + {10:Press ENTER or type command to continue}{1: } | + {3:-- TERMINAL --} | + ]]} -- Remaining chunks are discarded after vim.paste() failure. feed_data('line 3\nline 4\n') feed_data('line 5\nline 6\n') feed_data('line 7\nline 8\n') -- Stop paste. feed_data('\027[201~') - feed_data('\n') -- <Enter> + feed_data('\n') -- <CR> + expect_child_buf_lines({'foo',''}) --Dot-repeat/redo is not modified by failed paste. feed_data('.') screen:expect{grid=[[ @@ -388,7 +396,7 @@ describe('TUI', function() vim.paste = _G.save_paste_fn ]], {}) feed_data('\027[200~line A\nline B\n\027[201~') - feed_data('\n') -- <Enter> + feed_data('\n') -- <CR> screen:expect{grid=[[ foo | typed input...line A | @@ -414,7 +422,15 @@ describe('TUI', function() it("paste: 'nomodifiable' buffer", function() child_session:request('nvim_command', 'set nomodifiable') feed_data('\027[200~fail 1\nfail 2\n\027[201~') - screen:expect{any='Vim:E21'} + screen:expect{grid=[[ + | + {4:~ }| + {5: }| + {8:paste: Error executing lua: vim.lua:194: Vim:E21: }| + {8:Cannot make changes, 'modifiable' is off} | + {10:Press ENTER or type command to continue}{1: } | + {3:-- TERMINAL --} | + ]]} feed_data('\n') -- <Enter> child_session:request('nvim_command', 'set modifiable') feed_data('\027[200~success 1\nsuccess 2\n\027[201~') |