mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.5102: interrupt not caught in test
Problem: Interrupt not caught in test. Solution: Consider an exception thrown in the current try/catch when got_int is set. Also catch early exit when not using try/catch.
This commit is contained in:
@@ -1781,7 +1781,9 @@ ex_retab(exarg_T *eap)
|
|||||||
if (vcol >= MAXCOL)
|
if (vcol >= MAXCOL)
|
||||||
{
|
{
|
||||||
emsg(_(e_resulting_text_too_long));
|
emsg(_(e_resulting_text_too_long));
|
||||||
// set got_int to break out of any loop
|
// when not inside a try/catch set got_int to break out of any
|
||||||
|
// loop
|
||||||
|
if (trylevel == 0)
|
||||||
got_int = TRUE;
|
got_int = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -201,6 +201,7 @@ func RunTheTest(test)
|
|||||||
endtry
|
endtry
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
au VimLeavePre * call EarlyExit(g:testfunc)
|
||||||
if a:test =~ 'Test_nocatch_'
|
if a:test =~ 'Test_nocatch_'
|
||||||
" Function handles errors itself. This avoids skipping commands after the
|
" Function handles errors itself. This avoids skipping commands after the
|
||||||
" error.
|
" error.
|
||||||
@@ -212,9 +213,7 @@ func RunTheTest(test)
|
|||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
try
|
try
|
||||||
au VimLeavePre * call EarlyExit(g:testfunc)
|
|
||||||
exe 'call ' . a:test
|
exe 'call ' . a:test
|
||||||
au! VimLeavePre
|
|
||||||
catch /^\cskipped/
|
catch /^\cskipped/
|
||||||
call add(s:messages, ' Skipped')
|
call add(s:messages, ' Skipped')
|
||||||
call add(s:skipped, 'SKIPPED ' . a:test . ': ' . substitute(v:exception, '^\S*\s\+', '', ''))
|
call add(s:skipped, 'SKIPPED ' . a:test . ': ' . substitute(v:exception, '^\S*\s\+', '', ''))
|
||||||
@@ -222,6 +221,7 @@ func RunTheTest(test)
|
|||||||
call add(v:errors, 'Caught exception in ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint)
|
call add(v:errors, 'Caught exception in ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint)
|
||||||
endtry
|
endtry
|
||||||
endif
|
endif
|
||||||
|
au! VimLeavePre
|
||||||
|
|
||||||
" In case 'insertmode' was set and something went wrong, make sure it is
|
" In case 'insertmode' was set and something went wrong, make sure it is
|
||||||
" reset to avoid trouble with anything else.
|
" reset to avoid trouble with anything else.
|
||||||
|
@@ -82,20 +82,34 @@ func Test_retab_error()
|
|||||||
call assert_fails('ret 80000000000000000000', 'E475:')
|
call assert_fails('ret 80000000000000000000', 'E475:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" FIXME: the try/catch does not catch the interrupt
|
func RetabLoop()
|
||||||
func FIXME_Test_retab_endless()
|
|
||||||
new
|
|
||||||
call setline(1, "\t0\t")
|
|
||||||
let caught = 'no'
|
|
||||||
try
|
|
||||||
while 1
|
while 1
|
||||||
set ts=4000
|
set ts=4000
|
||||||
retab 4
|
retab 4
|
||||||
endwhile
|
endwhile
|
||||||
catch
|
endfunc
|
||||||
|
|
||||||
|
func Test_retab_endless()
|
||||||
|
" inside try/catch we catch the error message
|
||||||
|
new
|
||||||
|
call setline(1, "\t0\t")
|
||||||
|
let caught = 'no'
|
||||||
|
try
|
||||||
|
call RetabLoop()
|
||||||
|
catch /E1240:/
|
||||||
let caught = v:exception
|
let caught = v:exception
|
||||||
endtry
|
endtry
|
||||||
call assert_notequal('no', caught)
|
call assert_match('E1240:', caught)
|
||||||
|
bwipe!
|
||||||
|
set tabstop&
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_nocatch_retab_endless()
|
||||||
|
" not inside try/catch an interrupt is generated to get out of loops
|
||||||
|
new
|
||||||
|
call setline(1, "\t0\t")
|
||||||
|
call assert_fails('call RetabLoop()', ['E1240:', 'Interrupted'])
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
set tabstop&
|
set tabstop&
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -742,6 +742,7 @@ theend:
|
|||||||
suppress_errthrow = FALSE;
|
suppress_errthrow = FALSE;
|
||||||
in_assert_fails = FALSE;
|
in_assert_fails = FALSE;
|
||||||
did_emsg = FALSE;
|
did_emsg = FALSE;
|
||||||
|
got_int = FALSE;
|
||||||
msg_col = 0;
|
msg_col = 0;
|
||||||
need_wait_return = FALSE;
|
need_wait_return = FALSE;
|
||||||
emsg_on_display = FALSE;
|
emsg_on_display = FALSE;
|
||||||
|
@@ -734,6 +734,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
5102,
|
||||||
/**/
|
/**/
|
||||||
5101,
|
5101,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user