Read tests from command line and print test file name on failure

This commit is contained in:
Ben Jackson 2019-05-04 16:56:41 +01:00
commit f6e4b6cc5d
3 changed files with 31 additions and 4 deletions

View file

@ -30,12 +30,21 @@ echo "Running Vimspector Vim tests"
RESULT=0 RESULT=0
for t in *.test.vim; do TESTS="$@"
if [ -z "$TESTS" ]; then
TESTS=*.test.vim
fi
for t in ${TESTS}; do
echo "" echo ""
echo "%RUN: $t" echo "%RUN: $t"
rm -f messages debuglog rm -f messages debuglog
if ${RUN_TEST} $t --cmd 'au SwapExists * let v:swapchoice = "e"'; then # split on : into fileName and testName
IFS=: read -s t T <<< "$t"
if ${RUN_TEST} --cmd 'au SwapExists * let v:swapchoice = "e"' $t $T; then
echo "%PASS: $t PASSED" echo "%PASS: $t PASSED"
else else
cat messages cat messages

View file

@ -160,6 +160,13 @@ function! Test_Use_Mappings_HUMAN()
call vimspector#ClearBreakpoints() call vimspector#ClearBreakpoints()
let signs = sign_getplaced( '.', {
\ 'group': 'VimspectorBP',
\ } )
call assert_equal( 1, len( signs ), 1 )
call assert_equal( 0, len( signs[ 0 ].signs ) )
lcd - lcd -
bwipeout! bwipeout!
endfunction endfunction

View file

@ -83,6 +83,8 @@ func RunTheTest(test)
\ . ': ' \ . ': '
\ . v:exception \ . v:exception
\ . ' @ ' \ . ' @ '
\ . g:testpath
\ . ':'
\ . v:throwpoint) \ . v:throwpoint)
endtry endtry
endif endif
@ -97,6 +99,8 @@ func RunTheTest(test)
\ . ': ' \ . ': '
\ . v:exception \ . v:exception
\ . ' @ ' \ . ' @ '
\ . g:testpath
\ . ':'
\ . v:throwpoint) \ . v:throwpoint)
endtry endtry
endif endif
@ -126,6 +130,8 @@ func RunTheTest(test)
\ . ': ' \ . ': '
\ . v:exception \ . v:exception
\ . ' @ ' \ . ' @ '
\ . g:testpath
\ . ':'
\ . v:throwpoint) \ . v:throwpoint)
endtry endtry
endif endif
@ -143,6 +149,8 @@ func RunTheTest(test)
\ . ': ' \ . ': '
\ . v:exception \ . v:exception
\ . ' @ ' \ . ' @ '
\ . g:testpath
\ . ':'
\ . v:throwpoint) \ . v:throwpoint)
endtry endtry
endif endif
@ -156,6 +164,8 @@ func RunTheTest(test)
\ . ': ' \ . ': '
\ . v:exception \ . v:exception
\ . ' @ ' \ . ' @ '
\ . g:testpath
\ . ':'
\ . v:throwpoint) \ . v:throwpoint)
endtry endtry
endif endif
@ -219,7 +229,7 @@ func FinishTesting()
" Append errors to test.log " Append errors to test.log
split test.log split test.log
call append(line('$'), '') call append(line('$'), '')
call append(line('$'), 'From ' . g:testname . ':') call append(line('$'), 'From ' . g:testpath . ':')
call append(line('$'), s:errors) call append(line('$'), s:errors)
write write
endif endif
@ -244,7 +254,7 @@ func FinishTesting()
" Append messages to the file "messages" " Append messages to the file "messages"
split messages split messages
call append(line('$'), '') call append(line('$'), '')
call append(line('$'), 'From ' . g:testname . ':') call append(line('$'), 'From ' . g:testpath . ':')
call append(line('$'), s:messages) call append(line('$'), s:messages)
write write
@ -258,6 +268,7 @@ endfunc
" Source the test script. First grab the file name, in case the script " Source the test script. First grab the file name, in case the script
" navigates away. g:testname can be used by the tests. " navigates away. g:testname can be used by the tests.
let g:testname = expand('%') let g:testname = expand('%')
let g:testpath = expand('%:p')
let s:done = 0 let s:done = 0
let s:fail = 0 let s:fail = 0
let s:errors = [] let s:errors = []