aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testing.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-11 17:50:52 +0800
committerGitHub <noreply@github.com>2022-11-11 17:50:52 +0800
commit0d8e8d36ec7d3f4967f27389b4b94edf3ba57433 (patch)
tree94f62c40fbb8714ab4f811682e450fd8d7affd68 /src/nvim/testing.c
parentfc7ac688c397b5f748920597fcc70fe46e907944 (diff)
downloadrneovim-0d8e8d36ec7d3f4967f27389b4b94edf3ba57433.tar.gz
rneovim-0d8e8d36ec7d3f4967f27389b4b94edf3ba57433.tar.bz2
rneovim-0d8e8d36ec7d3f4967f27389b4b94edf3ba57433.zip
vim-patch:8.2.1919: assert_fails() setting emsg_silent changes normal execution (#20998)
Problem: Assert_fails() setting emsg_silent changes normal execution. Solution: Use a separate flag in_assert_fails. https://github.com/vim/vim/commit/28ee892ac4197421b3317f195512ca64cc56a5b4 Cherry-pick no_wait_return from patch 9.0.0846. Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/testing.c')
-rw-r--r--src/nvim/testing.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/nvim/testing.c b/src/nvim/testing.c
index 9dd41224da..a37ceeb86b 100644
--- a/src/nvim/testing.c
+++ b/src/nvim/testing.c
@@ -6,6 +6,8 @@
#include "nvim/eval.h"
#include "nvim/eval/encode.h"
#include "nvim/ex_docmd.h"
+#include "nvim/globals.h"
+#include "nvim/message.h"
#include "nvim/os/os.h"
#include "nvim/runtime.h"
#include "nvim/testing.h"
@@ -491,8 +493,8 @@ void f_assert_fails(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
// trylevel must be zero for a ":throw" command to be considered failed
trylevel = 0;
suppress_errthrow = true;
- emsg_silent = true;
- emsg_assert_fails_used = true;
+ in_assert_fails = true;
+ no_wait_return++;
do_cmdline_cmd(cmd);
if (called_emsg == called_emsg_before) {
@@ -584,9 +586,14 @@ void f_assert_fails(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
theend:
trylevel = save_trylevel;
suppress_errthrow = false;
- emsg_silent = false;
+ in_assert_fails = false;
+ did_emsg = false;
+ msg_col = 0;
+ no_wait_return--;
+ need_wait_return = false;
emsg_on_display = false;
- emsg_assert_fails_used = false;
+ msg_reset_scroll();
+ lines_left = Rows;
XFREE_CLEAR(emsg_assert_fails_msg);
set_vim_var_string(VV_ERRMSG, NULL, 0);
if (wrong_arg_msg != NULL) {