mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 01:16:31 +00:00
vim-patch:9.1.0415: Some functions are not tested
Problem: Some functions are not tested
Solution: Add a few more tests, fix a few minor problems
(Yegappan Lakshmanan)
closes: vim/vim#14789
fe424d13ef
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
@@ -3678,6 +3678,10 @@ static int eval_method(char **const arg, typval_T *const rettv, evalarg_T *const
|
||||
}
|
||||
xfree(tofree);
|
||||
|
||||
if (alias != NULL) {
|
||||
xfree(alias);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -3815,7 +3819,7 @@ static int check_can_index(typval_T *rettv, bool evaluate, bool verbose)
|
||||
/// slice() function
|
||||
void f_slice(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
{
|
||||
if (check_can_index(argvars, true, false) != OK) {
|
||||
if (check_can_index(&argvars[0], true, false) != OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -31,7 +31,13 @@ static int tv_op_blob(typval_T *tv1, const typval_T *tv2, const char *op)
|
||||
}
|
||||
|
||||
// Blob += Blob
|
||||
if (tv1->vval.v_blob == NULL || tv2->vval.v_blob == NULL) {
|
||||
if (tv2->vval.v_blob == NULL) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
if (tv1->vval.v_blob == NULL) {
|
||||
tv1->vval.v_blob = tv2->vval.v_blob;
|
||||
tv1->vval.v_blob->bv_refcount++;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@@ -3880,6 +3880,7 @@ static varnumber_T indexof_blob(blob_T *b, varnumber_T startidx, typval_T *expr)
|
||||
}
|
||||
}
|
||||
|
||||
const int called_emsg_start = called_emsg;
|
||||
for (varnumber_T idx = startidx; idx < tv_blob_len(b); idx++) {
|
||||
set_vim_var_nr(VV_KEY, idx);
|
||||
set_vim_var_nr(VV_VAL, tv_blob_get(b, (int)idx));
|
||||
@@ -3887,6 +3888,10 @@ static varnumber_T indexof_blob(blob_T *b, varnumber_T startidx, typval_T *expr)
|
||||
if (indexof_eval_expr(expr)) {
|
||||
return idx;
|
||||
}
|
||||
|
||||
if (called_emsg != called_emsg_start) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -3916,6 +3921,7 @@ static varnumber_T indexof_list(list_T *l, varnumber_T startidx, typval_T *expr)
|
||||
}
|
||||
}
|
||||
|
||||
const int called_emsg_start = called_emsg;
|
||||
for (; item != NULL; item = TV_LIST_ITEM_NEXT(l, item), idx++) {
|
||||
set_vim_var_nr(VV_KEY, idx);
|
||||
tv_copy(TV_LIST_ITEM_TV(item), get_vim_var_tv(VV_VAL));
|
||||
@@ -3926,6 +3932,10 @@ static varnumber_T indexof_list(list_T *l, varnumber_T startidx, typval_T *expr)
|
||||
if (found) {
|
||||
return idx;
|
||||
}
|
||||
|
||||
if (called_emsg != called_emsg_start) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -3942,7 +3952,8 @@ static void f_indexof(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((argvars[1].v_type == VAR_STRING && argvars[1].vval.v_string == NULL)
|
||||
if ((argvars[1].v_type == VAR_STRING
|
||||
&& (argvars[1].vval.v_string == NULL || *argvars[1].vval.v_string == NUL))
|
||||
|| (argvars[1].v_type == VAR_FUNC && argvars[1].vval.v_partial == NULL)) {
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user