comparison src/testdir/test_options.vim @ 30592:457ea0570b6f v9.0.0631

patch 9.0.0631: too many delete() calls in tests Commit: https://github.com/vim/vim/commit/145d1fd91041bd2a22a11eef0357702e420796e2 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 30 21:57:11 2022 +0100 patch 9.0.0631: too many delete() calls in tests Problem: Too many delete() calls in tests. Solution: Use deferred delete where possible.
author Bram Moolenaar <Bram@vim.org>
date Fri, 30 Sep 2022 23:00:10 +0200
parents 6a1862bfb280
children c2031ad5ed54
comparison
equal deleted inserted replaced
30591:38ef10db4a4e 30592:457ea0570b6f
690 let bsklist = split(&backupskip, ',') 690 let bsklist = split(&backupskip, ',')
691 call assert_equal(uniq(copy(bsklist)), bsklist) 691 call assert_equal(uniq(copy(bsklist)), bsklist)
692 call writefile(['errors:'] + v:errors, 'Xtestout') 692 call writefile(['errors:'] + v:errors, 'Xtestout')
693 qall 693 qall
694 [CODE] 694 [CODE]
695 call writefile(after, 'Xafter') 695 call writefile(after, 'Xafter', 'D')
696 let cmd = GetVimProg() . ' --not-a-term -S Xafter --cmd "set enc=utf8"' 696 let cmd = GetVimProg() . ' --not-a-term -S Xafter --cmd "set enc=utf8"'
697 697
698 let saveenv = {} 698 let saveenv = {}
699 for var in ['TMPDIR', 'TMP', 'TEMP'] 699 for var in ['TMPDIR', 'TMP', 'TEMP']
700 let saveenv[var] = getenv(var) 700 let saveenv[var] = getenv(var)
708 for var in ['TMPDIR', 'TMP', 'TEMP'] 708 for var in ['TMPDIR', 'TMP', 'TEMP']
709 call setenv(var, saveenv[var]) 709 call setenv(var, saveenv[var])
710 endfor 710 endfor
711 711
712 call delete('Xtestout') 712 call delete('Xtestout')
713 call delete('Xafter')
714 713
715 " Duplicates should be filtered out (option has P_NODUP) 714 " Duplicates should be filtered out (option has P_NODUP)
716 let backupskip = &backupskip 715 let backupskip = &backupskip
717 set backupskip= 716 set backupskip=
718 set backupskip+=/test/dir 717 set backupskip+=/test/dir
896 set buftype=nowrite 895 set buftype=nowrite
897 call assert_fails('write', 'E382:') 896 call assert_fails('write', 'E382:')
898 897
899 for val in ['', 'nofile', 'nowrite', 'acwrite', 'quickfix', 'help', 'terminal', 'prompt', 'popup'] 898 for val in ['', 'nofile', 'nowrite', 'acwrite', 'quickfix', 'help', 'terminal', 'prompt', 'popup']
900 exe 'set buftype=' .. val 899 exe 'set buftype=' .. val
901 call writefile(['something'], 'XBuftype') 900 call writefile(['something'], 'XBuftype', 'D')
902 call assert_fails('write XBuftype', 'E13:', 'with buftype=' .. val) 901 call assert_fails('write XBuftype', 'E13:', 'with buftype=' .. val)
903 endfor 902 endfor
904 903
905 call delete('XBuftype')
906 bwipe! 904 bwipe!
907 endfunc 905 endfunc
908 906
909 " Test for the 'rightleftcmd' option 907 " Test for the 'rightleftcmd' option
910 func Test_rightleftcmd() 908 func Test_rightleftcmd()
1127 below sp | wincmd _ 1125 below sp | wincmd _
1128 below sp | wincmd _ 1126 below sp | wincmd _
1129 below sp | wincmd _ 1127 below sp | wincmd _
1130 below sp 1128 below sp
1131 END 1129 END
1132 call writefile(lines, 'Xwinminheight') 1130 call writefile(lines, 'Xwinminheight', 'D')
1133 let buf = RunVimInTerminal('-S Xwinminheight', #{rows: 11}) 1131 let buf = RunVimInTerminal('-S Xwinminheight', #{rows: 11})
1134 call term_sendkeys(buf, ":set wmh=1\n") 1132 call term_sendkeys(buf, ":set wmh=1\n")
1135 call WaitForAssert({-> assert_match('E36: Not enough room', term_getline(buf, 11))}) 1133 call WaitForAssert({-> assert_match('E36: Not enough room', term_getline(buf, 11))})
1136 1134
1137 call StopVimInTerminal(buf) 1135 call StopVimInTerminal(buf)
1138 call delete('Xwinminheight')
1139 endfunc 1136 endfunc
1140 1137
1141 func Test_opt_winminheight_term_tabs() 1138 func Test_opt_winminheight_term_tabs()
1142 CheckRunVimInTerminal 1139 CheckRunVimInTerminal
1143 1140
1148 split 1145 split
1149 split 1146 split
1150 split 1147 split
1151 tabnew 1148 tabnew
1152 END 1149 END
1153 call writefile(lines, 'Xwinminheight') 1150 call writefile(lines, 'Xwinminheight', 'D')
1154 let buf = RunVimInTerminal('-S Xwinminheight', #{rows: 11}) 1151 let buf = RunVimInTerminal('-S Xwinminheight', #{rows: 11})
1155 call term_sendkeys(buf, ":set wmh=1\n") 1152 call term_sendkeys(buf, ":set wmh=1\n")
1156 call WaitForAssert({-> assert_match('E36: Not enough room', term_getline(buf, 11))}) 1153 call WaitForAssert({-> assert_match('E36: Not enough room', term_getline(buf, 11))})
1157 1154
1158 call StopVimInTerminal(buf) 1155 call StopVimInTerminal(buf)
1159 call delete('Xwinminheight')
1160 endfunc 1156 endfunc
1161 1157
1162 " Test for the 'winminwidth' option 1158 " Test for the 'winminwidth' option
1163 func Test_opt_winminwidth() 1159 func Test_opt_winminwidth()
1164 only! 1160 only!
1183 CheckRunVimInTerminal 1179 CheckRunVimInTerminal
1184 let vimrc =<< trim [CODE] 1180 let vimrc =<< trim [CODE]
1185 set scroll=2 1181 set scroll=2
1186 set laststatus=2 1182 set laststatus=2
1187 [CODE] 1183 [CODE]
1188 call writefile(vimrc, 'Xscroll') 1184 call writefile(vimrc, 'Xscroll', 'D')
1189 let buf = RunVimInTerminal('-S Xscroll', {'rows': 16, 'cols': 45}) 1185 let buf = RunVimInTerminal('-S Xscroll', {'rows': 16, 'cols': 45})
1190 call term_sendkeys(buf, ":verbose set scroll?\n") 1186 call term_sendkeys(buf, ":verbose set scroll?\n")
1191 call WaitForAssert({-> assert_match('Last set.*window size', term_getline(buf, 15))}) 1187 call WaitForAssert({-> assert_match('Last set.*window size', term_getline(buf, 15))})
1192 call assert_match('^\s*scroll=7$', term_getline(buf, 14)) 1188 call assert_match('^\s*scroll=7$', term_getline(buf, 14))
1189
1190 " clean up
1193 call StopVimInTerminal(buf) 1191 call StopVimInTerminal(buf)
1194
1195 " clean up
1196 call delete('Xscroll')
1197 endfunc 1192 endfunc
1198 1193
1199 " Check that VIM_POSIX env variable influences default value of 'cpo' and 'shm' 1194 " Check that VIM_POSIX env variable influences default value of 'cpo' and 'shm'
1200 func Test_VIM_POSIX() 1195 func Test_VIM_POSIX()
1201 let saved_VIM_POSIX = getenv("VIM_POSIX") 1196 let saved_VIM_POSIX = getenv("VIM_POSIX")