comparison src/testdir/test_autocmd.vim @ 13720:7d2039b2ecc8 v8.0.1732

patch 8.0.1732: crash when terminal API call deletes the buffer commit https://github.com/vim/vim/commit/a997b45c7e350ea5b378ca0c52ed3d4cc610975c Author: Bram Moolenaar <Bram@vim.org> Date: Tue Apr 17 23:24:06 2018 +0200 patch 8.0.1732: crash when terminal API call deletes the buffer Problem: Crash when terminal API call deletes the buffer. Solution: Lock the buffer while calling a function. (closes https://github.com/vim/vim/issues/2813)
author Christian Brabandt <cb@256bit.org>
date Tue, 17 Apr 2018 23:30:07 +0200
parents af68603e213d
children 8a3e9d1e8cf9
comparison
equal deleted inserted replaced
13719:fb1a9741c1c5 13720:7d2039b2ecc8
117 augroup test_autocmd_bufunload 117 augroup test_autocmd_bufunload
118 autocmd! 118 autocmd!
119 exe 'autocmd BufUnload <buffer> ' . (lastbuf + 1) . 'bwipeout!' 119 exe 'autocmd BufUnload <buffer> ' . (lastbuf + 1) . 'bwipeout!'
120 augroup END 120 augroup END
121 121
122 call assert_fails('edit bb.txt', 'E937:') 122 " Todo: check for E937 generated first
123 " call assert_fails('edit bb.txt', 'E937:')
124 call assert_fails('edit bb.txt', 'E517:')
123 125
124 autocmd! test_autocmd_bufunload 126 autocmd! test_autocmd_bufunload
125 augroup! test_autocmd_bufunload 127 augroup! test_autocmd_bufunload
126 bwipe! aa.txt 128 bwipe! aa.txt
127 bwipe! bb.txt 129 bwipe! bb.txt
314 call assert_equal('Xtestje3', expand('%')) 316 call assert_equal('Xtestje3', expand('%'))
315 317
316 e Xtestje2 318 e Xtestje2
317 sp Xtestje1 319 sp Xtestje1
318 call assert_fails('e', 'E937:') 320 call assert_fails('e', 'E937:')
319 call assert_equal('Xtestje2', expand('%')) 321 call assert_equal('Xtestje1', expand('%'))
320 322
321 " Test changing buffers in a BufWipeout autocommand. If this goes wrong 323 " Test changing buffers in a BufWipeout autocommand. If this goes wrong
322 " there are ml_line errors and/or a Crash. 324 " there are ml_line errors and/or a Crash.
323 au! 325 au!
324 only 326 only
336 1quit 338 1quit
337 call assert_equal('Xanother', expand('%')) 339 call assert_equal('Xanother', expand('%'))
338 340
339 au! 341 au!
340 enew 342 enew
341 bwipe! Xtestje1
342 call delete('Xtestje1') 343 call delete('Xtestje1')
343 call delete('Xtestje2') 344 call delete('Xtestje2')
344 call delete('Xtestje3') 345 call delete('Xtestje3')
345 endfunc 346 endfunc
346 347
1179 endfunc 1180 endfunc
1180 1181
1181 func Test_nocatch_wipe_all_buffers() 1182 func Test_nocatch_wipe_all_buffers()
1182 " Real nasty autocommand: wipe all buffers on any event. 1183 " Real nasty autocommand: wipe all buffers on any event.
1183 au * * bwipe * 1184 au * * bwipe *
1184 call assert_fails('next x', 'E93') 1185 " Get E93 first?
1186 " call assert_fails('next x', 'E93:')
1187 call assert_fails('next x', 'E517:')
1185 bwipe 1188 bwipe
1186 au! 1189 au!
1187 endfunc 1190 endfunc
1188 1191
1189 func Test_nocatch_wipe_dummy_buffer() 1192 func Test_nocatch_wipe_dummy_buffer()