0
0
mirror of https://github.com/vim/vim.git synced 2025-10-28 09:27:14 -04:00

patch 8.1.1362: code and data in tests can be hard to read

Problem:    Code and data in tests can be hard to read.
Solution:   Use the new heredoc style. (Yegappan Lakshmanan, closes #4400)
This commit is contained in:
Bram Moolenaar
2019-05-20 22:12:34 +02:00
parent 0b0ad35c33
commit c79745a82f
17 changed files with 987 additions and 831 deletions

View File

@@ -3,52 +3,56 @@
source shared.vim
func Test_exiting()
let after = [
\ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")',
\ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")',
\ 'quit',
\ ]
let after =<< trim [CODE]
au QuitPre * call writefile(["QuitPre"], "Xtestout")
au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")
quit
[CODE]
if RunVim([], after, '')
call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
endif
call delete('Xtestout')
let after = [
\ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")',
\ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")',
\ 'help',
\ 'wincmd w',
\ 'quit',
\ ]
let after =<< trim [CODE]
au QuitPre * call writefile(["QuitPre"], "Xtestout")
au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")
help
wincmd w
quit
[CODE]
if RunVim([], after, '')
call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
endif
call delete('Xtestout')
let after = [
\ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")',
\ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")',
\ 'split',
\ 'new',
\ 'qall',
\ ]
let after =<< trim [CODE]
au QuitPre * call writefile(["QuitPre"], "Xtestout")
au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")
split
new
qall
[CODE]
if RunVim([], after, '')
call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
endif
call delete('Xtestout')
let after = [
\ 'au QuitPre * call writefile(["QuitPre"], "Xtestout", "a")',
\ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")',
\ 'augroup nasty',
\ ' au ExitPre * split',
\ 'augroup END',
\ 'quit',
\ 'augroup nasty',
\ ' au! ExitPre',
\ 'augroup END',
\ 'quit',
\ ]
let after =<< trim [CODE]
au QuitPre * call writefile(["QuitPre"], "Xtestout", "a")
au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")
augroup nasty
au ExitPre * split
augroup END
quit
augroup nasty
au! ExitPre
augroup END
quit
[CODE]
if RunVim([], after, '')
call assert_equal(['QuitPre', 'ExitPre', 'QuitPre', 'ExitPre'],
\ readfile('Xtestout'))