Skip to content

Commit

Permalink
different way
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbra committed Jul 13, 2023
1 parent 4b3274c commit 0a0a11e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/testdir/runtest.vim
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,21 @@ func RunTheTest(test)
endif
endfunc

function Delete_Xtest_Files()
for file in glob('Xtest*', v:false, v:true)
call add(v:errors, file .. " exists when it shouldn't, trying to delete it!")
call delete(file)
if !empty(glob(file, v:false, v:true))
call add(v:errors, file .. " still exists after trying to delete it!")
if has('unix')
call system('rm -rf ' .. file)
endif
endif
endfor
endfunc

func AfterTheTest(func_name)
call Delete_Xtest_Files()
if len(v:errors) > 0
if match(s:may_fail_list, '^' .. a:func_name) >= 0
let s:fail_expected += 1
Expand Down
14 changes: 14 additions & 0 deletions src/testdir/test_quickfix.vim
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ source screendump.vim

set encoding=utf-8

function Kill_Xtest_stable_xxd()
if !empty(glob('Xtest_stable_xxd.txt', v:false, v:true))
call add(v:errors, "Xtest_stable_xxd.txt exists when it shouldn't, trying to delete it!")
call delete('Xtest_stable_xxd.txt')
if !empty(glob('Xtest_stable_xxd.txt', v:false, v:true))
call add(v:errors, "Xtest_stable_xxd.txt still exists after trying to delete it!")
if has('unix')
call system('rm -rf Xtest_stable_xxd.txt')
endif
endif
endif
endfunc

func s:setup_commands(cchar)
if a:cchar == 'c'
command! -nargs=* -bang Xlist <mods>clist<bang> <args>
Expand Down Expand Up @@ -4255,6 +4268,7 @@ endfunc

" The following test used to crash Vim
func Test_lvimgrep_crash()
call Kill_Xtest_stable_xxd()
sv Xtest
augroup QF_Test
au!
Expand Down

0 comments on commit 0a0a11e

Please sign in to comment.