Hi Bram and list, It is hard to notice even if an error occurs in SetUp() or TearDown() when making a make test
How to reproduce: - Explicitly put errors into SetUp() in vim/src/testdir/test_hide.vim. function SetUp() aaaaaaaaaa " <--------------------------------- Add this line. let s:save_hidden = &hidden let s:save_bufhidden = &bufhidden let s:save_autowrite = &autowrite set nohidden set bufhidden= set noautowrite endfunc - Run make test at vim/src directory. $ make test Expected behavior: - An error is displayed in the test result in an easy-to-understand manner. Actual behavior: - make test error in SetUp() and TearDown() is hard to understand. - An error is displayed for a moment, and no error is displayed in the test result. I wrote a patch. (Attached) After patched `make test` result: --------8<-------- >From test_hide.vim: Executing Test_hide() Executed 1 test 1 FAILED: Found errors in Test_hide(): Caught exception in SetUp() before Test_hide(): Vim:E492: Not an editor command: aaaaaaaaaa @ function RunTheTest[4]..SetUp, line 1 Caught exception in TearDown() after Test_hide(): Vim(let):E121: Undefined variable: s:save_hidden @ function RunTheTest[23]..TearDown, line 1 --------8<-------- Check and include it please. -- Best regards, Hirohito Higashi (a.k.a. h_east) -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim index c4cb847..3ba3b02 100644 --- a/src/testdir/runtest.vim +++ b/src/testdir/runtest.vim @@ -89,7 +89,11 @@ endfunc function RunTheTest(test) echo 'Executing ' . a:test if exists("*SetUp") - call SetUp() + try + call SetUp() + catch + call add(v:errors, 'Caught exception in SetUp() before ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint) + endtry endif call add(s:messages, 'Executing ' . a:test) @@ -104,7 +108,11 @@ function RunTheTest(test) endtry if exists("*TearDown") - call TearDown() + try + call TearDown() + catch + call add(v:errors, 'Caught exception in TearDown() after ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint) + endtry endif " Close any extra windows and make the current one not modified. @@ -221,3 +229,5 @@ call append(line('$'), s:messages) write qall! + +" vim: shiftwidth=2 sts=2 expandtab