patch 8.2.4234: test_garbagecollect_now() does not check v:testing
Problem: test_garbagecollect_now() does not check v:testing as documented.
Solution: Give an error if v:testing is not set.
diff --git a/src/testing.c b/src/testing.c
index 675eaa2..4e688a7 100644
--- a/src/testing.c
+++ b/src/testing.c
@@ -1153,7 +1153,10 @@
{
// 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);
}
/*