diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/autocmd/autocmd_spec.lua | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/functional/autocmd/autocmd_spec.lua b/test/functional/autocmd/autocmd_spec.lua index c010fb8034..6111654b5e 100644 --- a/test/functional/autocmd/autocmd_spec.lua +++ b/test/functional/autocmd/autocmd_spec.lua @@ -17,6 +17,7 @@ local command = helpers.command local exc_exec = helpers.exc_exec local exec_lua = helpers.exec_lua local curbufmeths = helpers.curbufmeths +local retry = helpers.retry local source = helpers.source describe('autocmd', function() @@ -439,6 +440,37 @@ describe('autocmd', function() ]]} end) + describe('v:event is readonly #18063', function() + it('during ChanOpen event', function() + command('autocmd ChanOpen * let v:event.info.id = 0') + funcs.jobstart({'cat'}) + retry(nil, nil, function() + eq('E46: Cannot change read-only variable "v:event.info"', meths.get_vvar('errmsg')) + end) + end) + + it('during ChanOpen event', function() + command('autocmd ChanInfo * let v:event.info.id = 0') + meths.set_client_info('foo', {}, 'remote', {}, {}) + retry(nil, nil, function() + eq('E46: Cannot change read-only variable "v:event.info"', meths.get_vvar('errmsg')) + end) + end) + + it('during RecordingLeave event', function() + command([[autocmd RecordingLeave * let v:event.regname = '']]) + eq('Vim(let):E46: Cannot change read-only variable "v:event.regname"', + pcall_err(command, 'normal! qqq')) + end) + + it('during TermClose event', function() + command('autocmd TermClose * let v:event.status = 0') + command('terminal') + eq('Vim(let):E46: Cannot change read-only variable "v:event.status"', + pcall_err(command, 'bdelete!')) + end) + end) + describe('old_tests', function() it('vimscript: WinNew ++once', function() source [[ |