Number assert {actual} is inside the range
assert_match({pat}, {text} [, {msg}])
Number assert {pat} matches {text}
+assert_nobeep({cmd}) Number assert {cmd} does not cause a beep
assert_notequal({exp}, {act} [, {msg}])
Number assert {exp} is not equal {act}
assert_notmatch({pat}, {text} [, {msg}])
assert_beeps({cmd}) *assert_beeps()*
Run {cmd} and add an error message to |v:errors| if it does
NOT produce a beep or visual bell.
- Also see |assert_fails()| and |assert-return|.
+ Also see |assert_fails()|, |assert_nobeep()| and
+ |assert-return|.
Can also be used as a |method|: >
GetCmd()->assert_beeps()
Can also be used as a |method|: >
getFile()->assert_match('foo.*')
+<
+assert_nobeep({cmd}) *assert_nobeep()*
+ Run {cmd} and add an error message to |v:errors| if it
+ produces a beep or visual bell.
+ Also see |assert_beeps()|.
+
+ Can also be used as a |method|: >
+ GetCmd()->assert_nobeep()
<
*assert_notequal()*
assert_notequal({expected}, {actual} [, {msg}])
ret_number_bool, f_assert_inrange},
{"assert_match", 2, 3, FEARG_2, NULL,
ret_number_bool, f_assert_match},
+ {"assert_nobeep", 1, 2, FEARG_1, NULL,
+ ret_number_bool, f_assert_nobeep},
{"assert_notequal", 2, 3, FEARG_2, NULL,
ret_number_bool, f_assert_notequal},
{"assert_notmatch", 2, 3, FEARG_2, NULL,
/* testing.c */
void f_assert_beeps(typval_T *argvars, typval_T *rettv);
+void f_assert_nobeep(typval_T *argvars, typval_T *rettv);
void f_assert_equal(typval_T *argvars, typval_T *rettv);
void f_assert_equalfile(typval_T *argvars, typval_T *rettv);
void f_assert_notequal(typval_T *argvars, typval_T *rettv);
if (*p == NUL)
return;
}
+ if (*p == NUL)
+ return;
if ((lpos = findmatch(NULL, NUL)) == NULL) // no match, so beep
vim_beep(BO_MATCH);
close!
endfunc
+func Test_empty_matchpairs()
+ split
+ set matchpairs= showmatch
+ call assert_nobeep('call feedkeys("ax\tx\t\<Esc>", "xt")')
+ set matchpairs& noshowmatch
+ bwipe!
+endfunc
+
func Test_mps_error()
let encoding_save = &encoding
}
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;
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);
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);
}
/*
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2694,
/**/
2693,
/**/