Patch 9.0.0846
Problem: Using assert_fails() may cause hit-enter prompt.
Solution: Set no_wait_return. (closes #11522)
Files: src/testing.c, src/testdir/test_assert.vim
*** ../vim-9.0.0845/src/testing.c 2022-09-17 21:07:52.099993159 +0100
--- src/testing.c 2022-11-09 00:40:07.495507683 +0000
***************
*** 592,598 ****
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;
--- 592,597 ----
***************
*** 608,620 ****
&& 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;
do_cmdline_cmd(cmd);
// reset here for any errors reported below
--- 607,619 ----
&& check_for_opt_string_arg(argvars, 4) == FAIL)))))
return;
// 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,763 ****
--- 757,763 ----
did_emsg = FALSE;
got_int = FALSE;
msg_col = 0;
+ --no_wait_return;
need_wait_return = FALSE;
emsg_on_display = FALSE;
msg_scrolled = 0;
*** ../vim-9.0.0845/src/testdir/test_assert.vim 2022-09-22 13:43:57.487406699
+0100
--- src/testdir/test_assert.vim 2022-11-09 00:39:42.615514151 +0000
***************
*** 338,343 ****
--- 338,349 ----
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'))
*** ../vim-9.0.0845/src/version.c 2022-11-08 21:39:59.941440721 +0000
--- src/version.c 2022-11-09 00:30:35.775656142 +0000
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 846,
/**/
--
My sister Cecilia opened a computer store in Hawaii.
She sells C shells by the seashore.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20221109004508.4605D1C076D%40moolenaar.net.