0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.1.0460: assert_fails() does not take a message argument

Problem:    assert_fails() does not take a message argument
Solution:   Add the argument.
This commit is contained in:
Bram Moolenaar
2018-10-07 20:16:49 +02:00
parent a05a0d325c
commit 1307d1c003
4 changed files with 22 additions and 3 deletions

View File

@@ -9041,6 +9041,8 @@ assert_fails(typval_T *argvars)
char_u *cmd = get_tv_string_chk(&argvars[0]);
garray_T ga;
int ret = 0;
char_u numbuf[NUMBUFLEN];
char_u *tofree;
called_emsg = FALSE;
suppress_errthrow = TRUE;
@@ -9050,7 +9052,14 @@ assert_fails(typval_T *argvars)
{
prepare_assert_error(&ga);
ga_concat(&ga, (char_u *)"command did not fail: ");
ga_concat(&ga, cmd);
if (argvars[1].v_type != VAR_UNKNOWN
&& argvars[2].v_type != VAR_UNKNOWN)
{
ga_concat(&ga, echo_string(&argvars[2], &tofree, numbuf, 0));
vim_free(tofree);
}
else
ga_concat(&ga, cmd);
assert_error(&ga);
ga_clear(&ga);
ret = 1;