comparison src/testdir/test_exit.vim @ 16720:9c90cf08cfa8 v8.1.1362

patch 8.1.1362: code and data in tests can be hard to read commit https://github.com/vim/vim/commit/c79745a82faeb5a6058e915ca49a4c69fa60ea01 Author: Bram Moolenaar <Bram@vim.org> Date: Mon May 20 22:12:34 2019 +0200 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 https://github.com/vim/vim/issues/4400)
author Bram Moolenaar <Bram@vim.org>
date Mon, 20 May 2019 22:15:06 +0200
parents 94e638936d3e
children fa6efc49d71f
comparison
equal deleted inserted replaced
16719:27f2a2799604 16720:9c90cf08cfa8
1 " Tests for exiting Vim. 1 " Tests for exiting Vim.
2 2
3 source shared.vim 3 source shared.vim
4 4
5 func Test_exiting() 5 func Test_exiting()
6 let after = [ 6 let after =<< trim [CODE]
7 \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")', 7 au QuitPre * call writefile(["QuitPre"], "Xtestout")
8 \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', 8 au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")
9 \ 'quit', 9 quit
10 \ ] 10 [CODE]
11
11 if RunVim([], after, '') 12 if RunVim([], after, '')
12 call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout')) 13 call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
13 endif 14 endif
14 call delete('Xtestout') 15 call delete('Xtestout')
15 16
16 let after = [ 17 let after =<< trim [CODE]
17 \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")', 18 au QuitPre * call writefile(["QuitPre"], "Xtestout")
18 \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', 19 au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")
19 \ 'help', 20 help
20 \ 'wincmd w', 21 wincmd w
21 \ 'quit', 22 quit
22 \ ] 23 [CODE]
24
23 if RunVim([], after, '') 25 if RunVim([], after, '')
24 call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout')) 26 call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
25 endif 27 endif
26 call delete('Xtestout') 28 call delete('Xtestout')
27 29
28 let after = [ 30 let after =<< trim [CODE]
29 \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout")', 31 au QuitPre * call writefile(["QuitPre"], "Xtestout")
30 \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', 32 au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")
31 \ 'split', 33 split
32 \ 'new', 34 new
33 \ 'qall', 35 qall
34 \ ] 36 [CODE]
37
35 if RunVim([], after, '') 38 if RunVim([], after, '')
36 call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout')) 39 call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
37 endif 40 endif
38 call delete('Xtestout') 41 call delete('Xtestout')
39 42
40 let after = [ 43 let after =<< trim [CODE]
41 \ 'au QuitPre * call writefile(["QuitPre"], "Xtestout", "a")', 44 au QuitPre * call writefile(["QuitPre"], "Xtestout", "a")
42 \ 'au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")', 45 au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")
43 \ 'augroup nasty', 46 augroup nasty
44 \ ' au ExitPre * split', 47 au ExitPre * split
45 \ 'augroup END', 48 augroup END
46 \ 'quit', 49 quit
47 \ 'augroup nasty', 50 augroup nasty
48 \ ' au! ExitPre', 51 au! ExitPre
49 \ 'augroup END', 52 augroup END
50 \ 'quit', 53 quit
51 \ ] 54 [CODE]
55
52 if RunVim([], after, '') 56 if RunVim([], after, '')
53 call assert_equal(['QuitPre', 'ExitPre', 'QuitPre', 'ExitPre'], 57 call assert_equal(['QuitPre', 'ExitPre', 'QuitPre', 'ExitPre'],
54 \ readfile('Xtestout')) 58 \ readfile('Xtestout'))
55 endif 59 endif
56 call delete('Xtestout') 60 call delete('Xtestout')