diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-08-27 05:19:36 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-08-28 00:55:13 +0200 |
commit | 3157baed83b7e94f2ff92e6fd97e85dab41a1c94 (patch) | |
tree | 60f1a41133c4de2ef36608141f8a6e5abddd0218 /test | |
parent | 46aa254bf30d567bd2da4fbfab33bbdcbb111a37 (diff) | |
download | rneovim-3157baed83b7e94f2ff92e6fd97e85dab41a1c94.tar.gz rneovim-3157baed83b7e94f2ff92e6fd97e85dab41a1c94.tar.bz2 rneovim-3157baed83b7e94f2ff92e6fd97e85dab41a1c94.zip |
API: TRY_WRAP() for "abort-causing non-exception errors"
- Introduce TRY_WRAP() until we have an *architectural* solution.
- TODO: bfredl idea: prepare error-handling at "top level" (nv_event).
- nvim_paste(): Revert luaeval() hack (see parent commit).
- With TRY_WRAP() in nvim_put(), 'nomodifiable' error now correctly
"bubbles up".
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/api/vim_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 26 |
2 files changed, 8 insertions, 20 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 884e07e2c5..647fab5c43 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -411,7 +411,7 @@ describe('API', function() end) it("fails if 'nomodifiable'", function() command('set nomodifiable') - expect_err([[Buffer is not 'modifiable']], request, + expect_err([[Vim:E21: Cannot make changes, 'modifiable' is off]], request, 'nvim_put', {'a','b'}, 'l', true, true) end) it('inserts text', function() diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 7435b293fd..5445ff0127 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -185,6 +185,7 @@ describe('TUI', function() {3:-- TERMINAL --} | ]]) feed_data('pasted from terminal') + expect_child_buf_lines({'"pasted from terminal"'}) screen:expect([[ "pasted from terminal{1:"} | {4:~ }| @@ -196,6 +197,7 @@ describe('TUI', function() ]]) feed_data('\027[201~') -- End paste. feed_data('\027\000') -- ESC: go to Normal mode. + wait_for_mode('n') screen:expect([[ "pasted from termina{1:l}" | {4:~ }| @@ -207,6 +209,8 @@ describe('TUI', function() ]]) -- Dot-repeat/redo. feed_data('2.') + expect_child_buf_lines( + {'"pasted from terminapasted from terminalpasted from terminall"'}) screen:expect([[ "pasted from terminapasted from terminalpasted fro| m termina{1:l}l" | @@ -341,18 +345,10 @@ describe('TUI', function() | {3:-- TERMINAL --} | ]]} - wait_for_mode('n') -- Start pasting... feed_data('\027[200~line 1\nline 2\n') - screen:expect{grid=[[ - foo | - | - {4:~ }| - {5: }| - {8:paste: Vim:E5108: Error while calling lua chunk fo}| - {10:Press ENTER or type command to continue}{1: } | - {3:-- TERMINAL --} | - ]]} + wait_for_mode('n') + screen:expect{any='paste: Error executing lua'} -- Remaining chunks are discarded after vim.paste() failure. feed_data('line 3\nline 4\n') feed_data('line 5\nline 6\n') @@ -402,15 +398,7 @@ 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{grid=[[ - | - {5: }| - {8:paste: Vim:E5108: Error while calling lua chunk fo}| - {8:r luaeval(): [string "-- Nvim-Lua stdlib: the `vim}| - {8:` module (:help l..."]:193: Buffer is not 'modifia}| - {10:Press ENTER or type command to continue}{1: } | - {3:-- TERMINAL --} | - ]]} + screen:expect{any='Vim:E21'} feed_data('\n') -- <Enter> child_session:request('nvim_command', 'set modifiable') feed_data('\027[200~success 1\nsuccess 2\n\027[201~') |