patch 8.0.1048: no test for what 8.0.1020 fixes
Problem: No test for what 8.0.1020 fixes.
Solution: Add test_feedinput(). Add a test. (Ozaki Kiichi, closes #2046)
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 626af7c..2692de6 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -393,6 +393,7 @@
static void f_tempname(typval_T *argvars, typval_T *rettv);
static void f_test_alloc_fail(typval_T *argvars, typval_T *rettv);
static void f_test_autochdir(typval_T *argvars, typval_T *rettv);
+static void f_test_feedinput(typval_T *argvars, typval_T *rettv);
static void f_test_override(typval_T *argvars, typval_T *rettv);
static void f_test_garbagecollect_now(typval_T *argvars, typval_T *rettv);
static void f_test_ignore_error(typval_T *argvars, typval_T *rettv);
@@ -851,6 +852,7 @@
#endif
{"test_alloc_fail", 3, 3, f_test_alloc_fail},
{"test_autochdir", 0, 0, f_test_autochdir},
+ {"test_feedinput", 1, 1, f_test_feedinput},
{"test_garbagecollect_now", 0, 0, f_test_garbagecollect_now},
{"test_ignore_error", 1, 1, f_test_ignore_error},
#ifdef FEAT_JOB_CHANNEL
@@ -12518,6 +12520,23 @@
}
/*
+ * "test_feedinput()"
+ */
+ static void
+f_test_feedinput(typval_T *argvars, typval_T *rettv UNUSED)
+{
+#ifdef USE_INPUT_BUF
+ char_u *val = get_tv_string_chk(&argvars[0]);
+
+ if (val != NULL)
+ {
+ trash_input_buf();
+ add_to_input_buf_csi(val, (int)STRLEN(val));
+ }
+#endif
+}
+
+/*
* "test_disable({name}, {val})" function
*/
static void