0
0
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:
Bram Moolenaar
2018-02-13 12:26:14 +01:00
parent 294959528e
commit b48e96f61c
9 changed files with 65 additions and 2 deletions

View File

@@ -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)
{