aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testing.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-10-27 13:32:47 +0800
committerGitHub <noreply@github.com>2022-10-27 13:32:47 +0800
commitc41873ab638589c1052404f5e5abef98a61db073 (patch)
tree4efcd2a9392b1cdfc3484eb712307c227c6d4667 /src/nvim/testing.c
parent1fe31651bce5021ea6d6dfe6fa426fde7795a77f (diff)
parent762ca67091d13336f90350a15e0a1b965d6d5c01 (diff)
downloadrneovim-c41873ab638589c1052404f5e5abef98a61db073.tar.gz
rneovim-c41873ab638589c1052404f5e5abef98a61db073.tar.bz2
rneovim-c41873ab638589c1052404f5e5abef98a61db073.zip
Merge pull request #20827 from zeertzjq/vim-8.2.4234
vim-patch:8.2.{2653,4234}
Diffstat (limited to 'src/nvim/testing.c')
-rw-r--r--src/nvim/testing.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/nvim/testing.c b/src/nvim/testing.c
index 348d5c6e29..45134db14f 100644
--- a/src/nvim/testing.c
+++ b/src/nvim/testing.c
@@ -14,6 +14,9 @@
# include "testing.c.generated.h"
#endif
+static char e_calling_test_garbagecollect_now_while_v_testing_is_not_set[]
+ = N_("E1142: Calling test_garbagecollect_now() while v:testing is not set");
+
/// Prepare "gap" for an assert error and add the sourcing position.
static void prepare_assert_error(garray_T *gap)
{
@@ -614,7 +617,11 @@ void f_test_garbagecollect_now(typval_T *argvars, typval_T *rettv, EvalFuncData
{
// This is dangerous, any Lists and Dicts used internally may be freed
// while still in use.
- garbage_collect(true);
+ if (!get_vim_var_nr(VV_TESTING)) {
+ emsg(_(e_calling_test_garbagecollect_now_while_v_testing_is_not_set));
+ } else {
+ garbage_collect(true);
+ }
}
/// "test_write_list_log()" function