Hi Bram and List,
How to reproduce:
- To duplicate Test_assert_false() in vim/src/testdir/test_assert.vim
$ cd vim/src
$ vim testdir/test_assert.vim
edit like below;
" Test that the methods used for testing work.
func Test_assert_false()
call assert_false(0)
endfunc
func Test_assert_false()
call assert_false(0)
endfunc
func Test_assert_true()
snip...
- run test_assert
$ make test_assert
cd testdir; rm -f test_assert.res; make -f Makefile test_assert.res
VIMPROG=../vim SCRIPTSOURCE=../../runtime
make[1]: Entering directory '/home/h_east/xxx/github/vim/src/testdir'
VIMRUNTIME=../../runtime; export VIMRUNTIME; ../vim -f -u unix.vim -U NONE
--noplugin -u runtest.vim test_assert.vim
Error detected while processing
/home/h_east/xxx/github/vim/src/testdir/test_assert.vim:
line 9:
E122: Function Test_assert_false already exists, add ! to replace it
function Test_assert_equal()
function Test_assert_false()
function Test_assert_true()
"test_assert.res" [New File]
"test_assert.res" "test_assert.res" [New File] 0 lines, 0 characters written
Executed 3 tests
make[1]: Leaving directory '/home/h_east/xxx/github/vim/src/testdir'
What happen:
- E122 occurred. but that error message does not write test.log and does not
display the result such as '1 FAILED'.
I think:
We should write script error message to the test.log, and display the last
result '1 FAILED'.
It would be useless to do so.
When number of test items is large, We will miss the error.
I wrote a patch.
Please check this.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim
index 0dc142e..6f3580b 100644
--- a/src/testdir/runtest.vim
+++ b/src/testdir/runtest.vim
@@ -38,7 +38,15 @@ endif
" Source the test script. First grab the file name, in case the script
" navigates away.
let testname = expand('%')
-source %
+let done = 0
+let fail = 0
+let errors = []
+try
+ source %
+catch
+ let fail += 1
+ call add(errors, 'Caught exception: ' . v:exception . ' @ ' . v:throwpoint)
+endtry
" Locate Test_ functions and execute them.
redir @q
@@ -46,9 +54,6 @@ function /^Test_
redir END
let tests = split(substitute(@q, 'function \(\k*()\)', '\1', 'g'))
-let done = 0
-let fail = 0
-let errors = []
for test in tests
if exists("*SetUp")
call SetUp()