diff options
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r-- | test/functional/api/vim_spec.lua | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 75b9fb71c9..a7d8dc59ec 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -1,6 +1,5 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') -local global_helpers = require('test.helpers') local NIL = helpers.NIL local clear, nvim, eq, neq = helpers.clear, helpers.nvim, helpers.eq, helpers.neq @@ -16,10 +15,10 @@ local request = helpers.request local source = helpers.source local next_msg = helpers.next_msg -local expect_err = global_helpers.expect_err -local format_string = global_helpers.format_string -local intchar2lua = global_helpers.intchar2lua -local mergedicts_copy = global_helpers.mergedicts_copy +local expect_err = helpers.expect_err +local format_string = helpers.format_string +local intchar2lua = helpers.intchar2lua +local mergedicts_copy = helpers.mergedicts_copy describe('API', function() before_each(clear) @@ -49,13 +48,30 @@ describe('API', function() it('handles errors in async requests', function() local error_types = meths.get_api_info()[2].error_types - nvim_async("bogus") + nvim_async('bogus') eq({'notification', 'nvim_error_event', {error_types.Exception.id, 'Invalid method: nvim_bogus'}}, next_msg()) -- error didn't close channel. eq(2, eval('1+1')) end) + it('failed async request emits nvim_error_event', function() + local error_types = meths.get_api_info()[2].error_types + nvim_async('command', 'bogus') + eq({'notification', 'nvim_error_event', + {error_types.Exception.id, 'Vim:E492: Not an editor command: bogus'}}, + next_msg()) + -- error didn't close channel. + eq(2, eval('1+1')) + end) + + it('does not set CA_COMMAND_BUSY #7254', function() + nvim('command', 'split') + nvim('command', 'autocmd WinEnter * startinsert') + nvim('command', 'wincmd w') + eq({mode='i', blocking=false}, nvim("get_mode")) + end) + describe('nvim_command', function() it('works', function() local fname = helpers.tmpname() @@ -83,7 +99,7 @@ describe('API', function() end) it('VimL execution error: fails with specific error', function() - local status, rv = pcall(nvim, "command_output", "buffer 23487") + local status, rv = pcall(nvim, "command", "buffer 23487") eq(false, status) -- nvim_command() failed. eq("E86: Buffer 23487 does not exist", string.match(rv, "E%d*:.*")) eq('', eval('v:errmsg')) -- v:errmsg was not updated. @@ -1267,7 +1283,7 @@ describe('API', function() end) it('returns attached UIs', function() local screen = Screen.new(20, 4) - screen:attach() + screen:attach({override=true}) local expected = { { chan = 1, @@ -1282,6 +1298,7 @@ describe('API', function() ext_messages = false, height = 4, rgb = true, + override = true, width = 20, } } @@ -1291,6 +1308,7 @@ describe('API', function() screen = Screen.new(44, 99) screen:attach({ rgb = false }) expected[1].rgb = false + expected[1].override = false expected[1].width = 44 expected[1].height = 99 eq(expected, nvim("list_uis")) |