diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 22:40:31 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 22:40:31 +0000 |
commit | 339e2d15cc26fe86988ea06468d912a46c8d6f29 (patch) | |
tree | a6167fc8fcfc6ae2dc102f57b2473858eac34063 /test/functional/core/exit_spec.lua | |
parent | 067dc73729267c0262438a6fdd66e586f8496946 (diff) | |
parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
download | rneovim-339e2d15cc26fe86988ea06468d912a46c8d6f29.tar.gz rneovim-339e2d15cc26fe86988ea06468d912a46c8d6f29.tar.bz2 rneovim-339e2d15cc26fe86988ea06468d912a46c8d6f29.zip |
Merge remote-tracking branch 'upstream/master' into fix_repeatcmdline
Diffstat (limited to 'test/functional/core/exit_spec.lua')
-rw-r--r-- | test/functional/core/exit_spec.lua | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/test/functional/core/exit_spec.lua b/test/functional/core/exit_spec.lua index 05a69e1992..d474b77806 100644 --- a/test/functional/core/exit_spec.lua +++ b/test/functional/core/exit_spec.lua @@ -25,30 +25,34 @@ describe('v:exiting', function() eq(1, eval('v:exiting is v:null')) end) - it('is 0 on normal exit', function() + local function test_exiting(setup_fn) local function on_setup() - command('autocmd VimLeavePre * call rpcrequest('..cid..', "")') - command('autocmd VimLeave * call rpcrequest('..cid..', "")') - command('quit') + command('autocmd VimLeavePre * call rpcrequest('..cid..', "exit", "VimLeavePre")') + command('autocmd VimLeave * call rpcrequest('..cid..', "exit", "VimLeave")') + setup_fn() end - local function on_request() + local requests_args = {} + local function on_request(name, args) + eq('exit', name) + table.insert(requests_args, args) eq(0, eval('v:exiting')) return '' end run(on_request, nil, on_setup) + eq({{'VimLeavePre'}, {'VimLeave'}}, requests_args) + end + + it('is 0 on normal exit', function() + test_exiting(function() + command('quit') + end) end) + it('is 0 on exit from Ex mode involving try-catch vim-patch:8.0.0184', function() - local function on_setup() - command('autocmd VimLeavePre * call rpcrequest('..cid..', "")') - command('autocmd VimLeave * call rpcrequest('..cid..', "")') + test_exiting(function() feed('gQ') feed_command('try', 'call NoFunction()', 'catch', 'echo "bye"', 'endtry', 'quit') - end - local function on_request() - eq(0, eval('v:exiting')) - return '' - end - run(on_request, nil, on_setup) + end) end) end) @@ -89,14 +93,14 @@ describe(':cquit', function() end) it('exits with redir msg for multiple exit codes after :cquit 1 2', function() - test_cq('cquit 1 2', nil, 'nvim_exec(): Vim(cquit):E488: Trailing characters: 2: cquit 1 2') + test_cq('cquit 1 2', nil, 'nvim_exec2(): Vim(cquit):E488: Trailing characters: 2: cquit 1 2') end) it('exits with redir msg for non-number exit code after :cquit X', function() - test_cq('cquit X', nil, 'nvim_exec(): Vim(cquit):E488: Trailing characters: X: cquit X') + test_cq('cquit X', nil, 'nvim_exec2(): Vim(cquit):E488: Trailing characters: X: cquit X') end) it('exits with redir msg for negative exit code after :cquit -1', function() - test_cq('cquit -1', nil, 'nvim_exec(): Vim(cquit):E488: Trailing characters: -1: cquit -1') + test_cq('cquit -1', nil, 'nvim_exec2(): Vim(cquit):E488: Trailing characters: -1: cquit -1') end) end) |