Patch 8.1.1660
Problem: Assert_fails() does not fail inside try/catch.
Solution: Set trylevel to zero. (Ozaki Kiichi, closes #4639)
Files: src/eval.c, src/testdir/test_assert.vim
*** ../vim-8.1.1659/src/eval.c 2019-07-05 22:14:12.086117124 +0200
--- src/eval.c 2019-07-10 22:02:38.848688297 +0200
***************
*** 9910,9919 ****
--- 9910,9923 ----
char_u *cmd = tv_get_string_chk(&argvars[0]);
garray_T ga;
int ret = 0;
+ int save_trylevel = trylevel;
+ // trylevel must be zero for a ":throw" command to be considered failed
+ trylevel = 0;
called_emsg = FALSE;
suppress_errthrow = TRUE;
emsg_silent = TRUE;
+
do_cmdline_cmd(cmd);
if (!called_emsg)
{
***************
*** 9939,9948 ****
assert_append_cmd_or_arg(&ga, argvars, cmd);
assert_error(&ga);
ga_clear(&ga);
! ret = 1;
}
}
called_emsg = FALSE;
suppress_errthrow = FALSE;
emsg_silent = FALSE;
--- 9943,9953 ----
assert_append_cmd_or_arg(&ga, argvars, cmd);
assert_error(&ga);
ga_clear(&ga);
! ret = 1;
}
}
+ trylevel = save_trylevel;
called_emsg = FALSE;
suppress_errthrow = FALSE;
emsg_silent = FALSE;
*** ../vim-8.1.1659/src/testdir/test_assert.vim 2019-06-13 22:19:04.533918194
+0200
--- src/testdir/test_assert.vim 2019-07-10 21:59:36.705549072 +0200
***************
*** 166,171 ****
--- 166,177 ----
call remove(v:errors, 0)
endfunc
+ func Test_assert_fails_in_try_block()
+ try
+ call assert_equal(0, assert_fails('throw "error"'))
+ endtry
+ endfunc
+
func Test_assert_beeps()
new
call assert_equal(0, assert_beeps('normal h'))
*** ../vim-8.1.1659/src/version.c 2019-07-10 21:55:50.770597935 +0200
--- src/version.c 2019-07-10 22:00:49.225207651 +0200
***************
*** 779,780 ****
--- 779,782 ----
{ /* Add new patch number below this line */
+ /**/
+ 1660,
/**/
--
MARTHA'S WAY: Don't throw out all that leftover wine. Freeze into ice cubes
for future use in casseroles and sauces.
MY WAY: What leftover wine?
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/201907102005.x6AK54SU032619%40masaka.moolenaar.net.
For more options, visit https://groups.google.com/d/optout.