diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-11-09 00:44:30 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-11-09 00:44:30 +0000 |
commit | f220643c260d55d21a841a3c4032daadc41bc50b (patch) | |
tree | 2ce47a4e19938b25b02dd0cb5a13327e20ee2f13 /src | |
parent | 4e7590ec00483077daaa567aa2220bc8df912f3c (diff) |
patch 9.0.0846: using assert_fails() may cause hit-enter promptv9.0.0846
Problem: Using assert_fails() may cause hit-enter prompt.
Solution: Set no_wait_return. (closes #11522)
Diffstat (limited to 'src')
-rw-r--r-- | src/testdir/test_assert.vim | 6 | ||||
-rw-r--r-- | src/testing.c | 6 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/testdir/test_assert.vim b/src/testdir/test_assert.vim index 89ac012840..42dd6a9d6a 100644 --- a/src/testdir/test_assert.vim +++ b/src/testdir/test_assert.vim @@ -338,6 +338,12 @@ func Test_assert_fails_in_try_block() endtry endfunc +func Test_assert_fails_in_timer() + " should not cause a hit-enter prompt, which isn't actually checked here + call timer_start(0, {-> assert_fails('call', 'E471:')}) + sleep 10m +endfunc + func Test_assert_beeps() new call assert_equal(0, assert_beeps('normal h')) diff --git a/src/testing.c b/src/testing.c index 7bb14e1b57..d76d098ee0 100644 --- a/src/testing.c +++ b/src/testing.c @@ -592,7 +592,6 @@ f_assert_exception(typval_T *argvars, typval_T *rettv) void f_assert_fails(typval_T *argvars, typval_T *rettv) { - char_u *cmd; garray_T ga; int save_trylevel = trylevel; int called_emsg_before = called_emsg; @@ -608,13 +607,13 @@ f_assert_fails(typval_T *argvars, typval_T *rettv) && check_for_opt_string_arg(argvars, 4) == FAIL))))) return; - cmd = tv_get_string_chk(&argvars[0]); - // trylevel must be zero for a ":throw" command to be considered failed trylevel = 0; suppress_errthrow = TRUE; in_assert_fails = TRUE; + ++no_wait_return; + char_u *cmd = tv_get_string_chk(&argvars[0]); do_cmdline_cmd(cmd); // reset here for any errors reported below @@ -758,6 +757,7 @@ theend: did_emsg = FALSE; got_int = FALSE; msg_col = 0; + --no_wait_return; need_wait_return = FALSE; emsg_on_display = FALSE; msg_scrolled = 0; diff --git a/src/version.c b/src/version.c index 097fcf6abf..f305f3cc71 100644 --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 846, +/**/ 845, /**/ 844, |