mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.0.1510: cannot test if a command causes a beep
Problem: Cannot test if a command causes a beep. Solution: Add assert_beeps().
This commit is contained in:
23
src/eval.c
23
src/eval.c
@@ -8941,6 +8941,29 @@ assert_exception(typval_T *argvars)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
assert_beeps(typval_T *argvars)
|
||||
{
|
||||
char_u *cmd = get_tv_string_chk(&argvars[0]);
|
||||
garray_T ga;
|
||||
|
||||
called_vim_beep = FALSE;
|
||||
suppress_errthrow = TRUE;
|
||||
emsg_silent = FALSE;
|
||||
do_cmdline_cmd(cmd);
|
||||
if (!called_vim_beep)
|
||||
{
|
||||
prepare_assert_error(&ga);
|
||||
ga_concat(&ga, (char_u *)"command did not beep: ");
|
||||
ga_concat(&ga, cmd);
|
||||
assert_error(&ga);
|
||||
ga_clear(&ga);
|
||||
}
|
||||
|
||||
suppress_errthrow = FALSE;
|
||||
emsg_on_display = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
assert_fails(typval_T *argvars)
|
||||
{
|
||||
|
Reference in New Issue
Block a user