Skip to content

Commit

Permalink
patch 8.2.4297: Vim9: not all code covered by tests
Browse files Browse the repository at this point in the history
Problem:    Vim9: not all code covered by tests.
Solution:   Add a couple more tests.
  • Loading branch information
brammool committed Feb 4, 2022
1 parent 83d0cec commit 21ebb08
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/testdir/test_vim9_disassemble.vim
Expand Up @@ -2487,6 +2487,44 @@ def Test_debug_for()
res)
enddef

def s:TryCatch()
try
echo "try"
catch /error/
echo "caught"
endtry
enddef

def Test_debug_try_catch()
var res = execute('disass debug s:TryCatch')
assert_match('<SNR>\d*_TryCatch\_s*' ..
'try\_s*' ..
'0 DEBUG line 1-1 varcount 0\_s*' ..
'1 TRY catch -> 7, endtry -> 17\_s*' ..
'echo "try"\_s*' ..
'2 DEBUG line 2-2 varcount 0\_s*' ..
'3 PUSHS "try"\_s*' ..
'4 ECHO 1\_s*' ..
'catch /error/\_s*' ..
'5 DEBUG line 3-3 varcount 0\_s*' ..
'6 JUMP -> 17\_s*' ..
'7 DEBUG line 4-3 varcount 0\_s*' ..
'8 PUSH v:exception\_s*' ..
'9 PUSHS "error"\_s*' ..
'10 COMPARESTRING =\~\_s*' ..
'11 JUMP_IF_FALSE -> 17\_s*' ..
'12 CATCH\_s*' ..
'echo "caught"\_s*' ..
'13 DEBUG line 4-4 varcount 0\_s*' ..
'14 PUSHS "caught"\_s*' ..
'15 ECHO 1\_s*' ..
'endtry\_s*' ..
'16 DEBUG line 5-5 varcount 0\_s*' ..
'17 ENDTRY\_s*' ..
'\d\+ RETURN void',
res)
enddef

func s:Legacy() dict
echo 'legacy'
endfunc
Expand Down
8 changes: 8 additions & 0 deletions src/testdir/test_vim9_script.vim
Expand Up @@ -1580,6 +1580,14 @@ def Test_if_const_expr()
burp
endif

if 0
if 1
echo nothing
elseif 1
echo still nothing
endif
endif

# expression with line breaks skipped
if false
('aaa'
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -746,6 +746,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4297,
/**/
4296,
/**/
Expand Down

0 comments on commit 21ebb08

Please sign in to comment.