diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-02-13 12:26:14 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-02-13 12:26:14 +0100 |
commit | b48e96f61c87a64e38e3ac50732c92a84a4833b8 (patch) | |
tree | 170cf91f5865fda3f985328c50b5d009e5296a3b /src/eval.c | |
parent | 294959528e02403cd7ef6541208835f0c621c63b (diff) |
patch 8.0.1510: cannot test if a command causes a beepv8.0.1510
Problem: Cannot test if a command causes a beep.
Solution: Add assert_beeps().
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c index 2c93e4ec4b..b1f7a86061 100644 --- a/src/eval.c +++ b/src/eval.c @@ -8942,6 +8942,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) { char_u *cmd = get_tv_string_chk(&argvars[0]); |