To: vim_dev@googlegroups.com Subject: Patch 8.1.0456 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0456 Problem: Running test hangs when the input file is being edited. Solution: Use a SwapExists autocommand to ignore editing the test script. Files: src/testdir/Makefile, src/testdir/runtest.vim *** ../vim-8.1.0455/src/testdir/Makefile 2018-09-21 16:37:20.084248861 +0200 --- src/testdir/Makefile 2018-10-07 15:34:14.706152514 +0200 *************** *** 9,16 **** SCRIPTSOURCE = ../../runtime ! # Change this to empty to see the verbose output of tests. ! REDIR_TEST_TO_NULL = > /dev/null # Uncomment this line to use valgrind for memory leaks and extra warnings. # The output goes into a file "valgrind.testN" --- 9,18 ---- SCRIPTSOURCE = ../../runtime ! # Comment out this line to see the verbose output of tests. ! # ! # Catches SwapExists to avoid hanging at the ATTENTION prompt. ! REDIR_TEST_TO_NULL = --cmd 'au SwapExists * let v:swapchoice = "e"' > /dev/null # Uncomment this line to use valgrind for memory leaks and extra warnings. # The output goes into a file "valgrind.testN" *** ../vim-8.1.0455/src/testdir/runtest.vim 2018-08-19 17:03:57.365405046 +0200 --- src/testdir/runtest.vim 2018-10-07 15:36:08.881535882 +0200 *************** *** 57,62 **** --- 57,75 ---- set encoding=latin1 endif + " REDIR_TEST_TO_NULL has a very permissive SwapExists autocommand which is for + " the test_name.vim file itself. Replace it here with a more restrictive one, + " so we still catch mistakes. + let s:test_script_fname = expand('%') + au! SwapExists * call HandleSwapExists() + func HandleSwapExists() + " Only ignore finding a swap file for the test script (the user might be + " editing it and do ":make test_name") and the output file. + if expand('') == 'messages' || expand('') =~ s:test_script_fname + let v:swapchoice = 'e' + endif + endfunc + " Avoid stopping at the "hit enter" prompt set nomore *************** *** 146,151 **** --- 159,165 ---- " Clear any autocommands au! + au SwapExists * call HandleSwapExists() " Close any extra tab pages and windows and make the current one not modified. while tabpagenr('$') > 1 *** ../vim-8.1.0455/src/version.c 2018-10-07 14:38:43.714247899 +0200 --- src/version.c 2018-10-07 15:32:36.262911893 +0200 *************** *** 794,795 **** --- 794,797 ---- { /* Add new patch number below this line */ + /**/ + 456, /**/ -- hundred-and-one symptoms of being an internet addict: 166. You have been on your computer soo long that you didn't realize you had grandchildren. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///