comparison src/testdir/runtest.vim @ 17356:4fe44a3b732f v8.1.1677

patch 8.1.1677: tests get stuck when running into an existing swapfile commit https://github.com/vim/vim/commit/b073da8929ae0c03c403197197ed6b57f0f3d3be Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 13 14:47:26 2019 +0200 patch 8.1.1677: tests get stuck when running into an existing swapfile Problem: Tests get stuck when running into an existing swapfile. Solution: Set v:swapchoice to "q" and report an error. (Daniel Hahler, closes #4644)
author Bram Moolenaar <Bram@vim.org>
date Sat, 13 Jul 2019 15:00:05 +0200
parents efc6f5e3b543
children e2bfdd281578
comparison
equal deleted inserted replaced
17355:e426b24ee7ed 17356:4fe44a3b732f
66 " the test_name.vim file itself. Replace it here with a more restrictive one, 66 " the test_name.vim file itself. Replace it here with a more restrictive one,
67 " so we still catch mistakes. 67 " so we still catch mistakes.
68 let s:test_script_fname = expand('%') 68 let s:test_script_fname = expand('%')
69 au! SwapExists * call HandleSwapExists() 69 au! SwapExists * call HandleSwapExists()
70 func HandleSwapExists() 70 func HandleSwapExists()
71 " Only ignore finding a swap file for the test script (the user might be 71 " Ignore finding a swap file for the test script (the user might be
72 " editing it and do ":make test_name") and the output file. 72 " editing it and do ":make test_name") and the output file.
73 " Report finding another swap file and chose 'q' to avoid getting stuck.
73 if expand('<afile>') == 'messages' || expand('<afile>') =~ s:test_script_fname 74 if expand('<afile>') == 'messages' || expand('<afile>') =~ s:test_script_fname
74 let v:swapchoice = 'e' 75 let v:swapchoice = 'e'
76 else
77 call assert_report('Unexpected swap file: ' .. v:swapname)
78 let v:swapchoice = 'q'
75 endif 79 endif
76 endfunc 80 endfunc
77 81
78 " Avoid stopping at the "hit enter" prompt 82 " Avoid stopping at the "hit enter" prompt
79 set nomore 83 set nomore