mirror of
https://github.com/neovim/neovim.git
synced 2025-09-13 06:48:17 +00:00
vim-patch:8.0.1510: cannot assert beep #9938
Problem: Cannot test if a command causes a beep.
Solution: Add assert_beeps().
b48e96f61c
This commit is contained in:

committed by
Justin M. Keyes

parent
24a9516ff4
commit
9d77a07686
@@ -6877,6 +6877,27 @@ static void assert_equal_common(typval_T *argvars, assert_type_T atype)
|
||||
}
|
||||
}
|
||||
|
||||
static void f_assert_beeps(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
{
|
||||
const char *const cmd = tv_get_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, (const char_u *)"command did not beep: ");
|
||||
ga_concat(&ga, (const char_u *)cmd);
|
||||
assert_error(&ga);
|
||||
ga_clear(&ga);
|
||||
}
|
||||
|
||||
suppress_errthrow = false;
|
||||
emsg_on_display = false;
|
||||
}
|
||||
|
||||
// "assert_equal(expected, actual[, msg])" function
|
||||
static void f_assert_equal(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
{
|
||||
|
Reference in New Issue
Block a user