Mercurial > vim
diff src/eval.c @ 14897:0c845463a0db v8.1.0460
patch 8.1.0460: assert_fails() does not take a message argument
commit https://github.com/vim/vim/commit/1307d1c003b01b4f67524c95feb07c3d91c7c428
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Oct 7 20:16:49 2018 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 07 Oct 2018 20:30:06 +0200 |
parents | 27b9a84395b5 |
children | 162d79d273e6 |
line wrap: on
line diff
--- a/src/eval.c +++ b/src/eval.c @@ -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;