comparison src/testdir/test_autocmd.vim @ 13798:415185e2c970 v8.0.1771

patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why commit https://github.com/vim/vim/commit/50182fa84e20a0547f3e2bd6683ef799fcd27855 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 28 21:34:40 2018 +0200 patch 8.0.1771: in tests, when WaitFor() fails it doesn't say why Problem: In tests, when WaitFor() fails it doesn't say why. (James McCoy) Solution: Add WaitForAssert(), which produces an assert error when it fails.
author Christian Brabandt <cb@256bit.org>
date Sat, 28 Apr 2018 21:45:06 +0200
parents 8a3e9d1e8cf9
children 3b87daa5c37a
comparison
equal deleted inserted replaced
13797:2dc47db0d0d5 13798:415185e2c970
1320 " Prepare file for TextChanged event. 1320 " Prepare file for TextChanged event.
1321 call writefile([''], 'Xchanged.txt') 1321 call writefile([''], 'Xchanged.txt')
1322 let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3}) 1322 let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3})
1323 call assert_equal('running', term_getstatus(buf)) 1323 call assert_equal('running', term_getstatus(buf))
1324 " Wait for the ruler (in the status line) to be shown. 1324 " Wait for the ruler (in the status line) to be shown.
1325 call WaitFor({-> term_getline(buf, 3) =~# '\<All$'}) 1325 call WaitForAssert({-> assert_match('\<All$', term_getline(buf, 3))})
1326 " It's only adding autocmd, so that no event occurs. 1326 " It's only adding autocmd, so that no event occurs.
1327 call term_sendkeys(buf, ":au! TextChanged <buffer> call writefile(['No'], 'Xchanged.txt')\<cr>") 1327 call term_sendkeys(buf, ":au! TextChanged <buffer> call writefile(['No'], 'Xchanged.txt')\<cr>")
1328 call term_sendkeys(buf, "\<C-\\>\<C-N>:qa!\<cr>") 1328 call term_sendkeys(buf, "\<C-\\>\<C-N>:qa!\<cr>")
1329 call WaitFor({-> term_getstatus(buf) == 'finished'}) 1329 call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))})
1330 call assert_equal([''], readfile('Xchanged.txt')) 1330 call assert_equal([''], readfile('Xchanged.txt'))
1331 1331
1332 " clean up 1332 " clean up
1333 call delete('Xchanged.txt') 1333 call delete('Xchanged.txt')
1334 bwipe! 1334 bwipe!