summaryrefslogtreecommitdiff
path: root/src/testdir/test_retab.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-06-15 20:49:35 +0100
committerBram Moolenaar <Bram@vim.org>2022-06-15 20:49:35 +0100
commit8bea171f154845046239c61bdef50a8e0f12f643 (patch)
treeda8174d7704421002afd6c1b31c4ce21505d16ff /src/testdir/test_retab.vim
parentcf65d88ff844f042337dfd043e6e98f3b9270577 (diff)
downloadvim-git-8bea171f154845046239c61bdef50a8e0f12f643.tar.gz
patch 8.2.5102: interrupt not caught in testv8.2.5102
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.
Diffstat (limited to 'src/testdir/test_retab.vim')
-rw-r--r--src/testdir/test_retab.vim30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/testdir/test_retab.vim b/src/testdir/test_retab.vim
index 34ab7e1f9..2d96042dc 100644
--- a/src/testdir/test_retab.vim
+++ b/src/testdir/test_retab.vim
@@ -82,20 +82,34 @@ func Test_retab_error()
call assert_fails('ret 80000000000000000000', 'E475:')
endfunc
-" FIXME: the try/catch does not catch the interrupt
-func FIXME_Test_retab_endless()
+func RetabLoop()
+ while 1
+ set ts=4000
+ retab 4
+ endwhile
+endfunc
+
+func Test_retab_endless()
+ " inside try/catch we catch the error message
new
call setline(1, "\t0\t")
let caught = 'no'
try
- while 1
- set ts=4000
- retab 4
- endwhile
- catch
+ call RetabLoop()
+ catch /E1240:/
let caught = v:exception
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!
set tabstop&
endfunc