diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-04-02 18:55:57 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-04-02 18:55:57 +0200 |
commit | 5b8cabfef7c3707f3e53e13844d90e5a217e1e84 (patch) | |
tree | 419de5d628c379b090538a811bb6d33270dcdd85 /src/testing.c | |
parent | dcf29ac87f4d7a62c503ba6de0d92c7779446bf2 (diff) |
patch 8.2.2694: when 'matchpairs' is empty every character beepsv8.2.2694
Problem: When 'matchpairs' is empty every character beeps. (Marco Hinz)
Solution: Bail out when no character in 'matchpairs' was found.
(closes #8053) Add assert_nobeep().
Diffstat (limited to 'src/testing.c')
-rw-r--r-- | src/testing.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/testing.c b/src/testing.c index df19b9eb49..740923735c 100644 --- a/src/testing.c +++ b/src/testing.c @@ -338,7 +338,7 @@ assert_append_cmd_or_arg(garray_T *gap, typval_T *argvars, char_u *cmd) } static int -assert_beeps(typval_T *argvars) +assert_beeps(typval_T *argvars, int no_beep) { char_u *cmd = tv_get_string_chk(&argvars[0]); garray_T ga; @@ -348,10 +348,13 @@ assert_beeps(typval_T *argvars) suppress_errthrow = TRUE; emsg_silent = FALSE; do_cmdline_cmd(cmd); - if (!called_vim_beep) + if (no_beep ? called_vim_beep : !called_vim_beep) { prepare_assert_error(&ga); - ga_concat(&ga, (char_u *)"command did not beep: "); + if (no_beep) + ga_concat(&ga, (char_u *)"command did beep: "); + else + ga_concat(&ga, (char_u *)"command did not beep: "); ga_concat(&ga, cmd); assert_error(&ga); ga_clear(&ga); @@ -369,7 +372,16 @@ assert_beeps(typval_T *argvars) void f_assert_beeps(typval_T *argvars, typval_T *rettv) { - rettv->vval.v_number = assert_beeps(argvars); + rettv->vval.v_number = assert_beeps(argvars, FALSE); +} + +/* + * "assert_nobeep(cmd [, error])" function + */ + void +f_assert_nobeep(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = assert_beeps(argvars, TRUE); } /* |