vim-patch:8.2.3421: a bit of code is not covered by tests (#19895)

Problem:    A bit of code is not covered by tests.
Solution:   Add a few more test cases. (Dominique Pellé, closes vim/vim#8857)
d176ca3dde

Cherry-pick Test_trim() change from patch 8.2.0448.
Cherry-pick Test_History() change from patch 8.2.1736.
Cherry-pick charidx() and trim() type checks from patch 8.2.3135.
This commit is contained in:
zeertzjq
2022-08-22 22:09:53 +08:00
committed by GitHub
parent 15a768eeb0
commit baaaa1f2b3
4 changed files with 32 additions and 6 deletions

View File

@@ -874,7 +874,8 @@ static void f_charidx(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[0].v_type != VAR_STRING
|| argvars[1].v_type != VAR_NUMBER
|| (argvars[2].v_type != VAR_UNKNOWN
&& argvars[2].v_type != VAR_NUMBER)) {
&& argvars[2].v_type != VAR_NUMBER
&& argvars[2].v_type != VAR_BOOL)) {
emsg(_(e_invarg));
return;
}
@@ -9460,6 +9461,11 @@ static void f_trim(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
if (argvars[1].v_type != VAR_UNKNOWN && argvars[1].v_type != VAR_STRING) {
semsg(_(e_invarg2), tv_get_string(&argvars[1]));
return;
}
if (argvars[1].v_type == VAR_STRING) {
mask = (const char_u *)tv_get_string_buf_chk(&argvars[1], buf2);
if (argvars[2].v_type != VAR_UNKNOWN) {