mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
eval: Fix setmatches(), setqflist() and setloclist()
This commit is contained in:
parent
f572bd7e4e
commit
5008205a3e
@ -14653,8 +14653,8 @@ skip_args:
|
|||||||
title = (wp ? "setloclist()" : "setqflist()");
|
title = (wp ? "setloclist()" : "setqflist()");
|
||||||
}
|
}
|
||||||
|
|
||||||
list_T *l = list_arg->vval.v_list;
|
list_T *const l = list_arg->vval.v_list;
|
||||||
if (l && set_errorlist(wp, l, action, (char_u *)title, d) == OK) {
|
if (set_errorlist(wp, l, action, (char_u *)title, d) == OK) {
|
||||||
rettv->vval.v_number = 0;
|
rettv->vval.v_number = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14687,9 +14687,7 @@ static void f_setmatches(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
EMSG(_(e_listreq));
|
EMSG(_(e_listreq));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
list_T *l;
|
list_T *const l = argvars[0].vval.v_list;
|
||||||
if ((l = argvars[0].vval.v_list) != NULL) {
|
|
||||||
|
|
||||||
// To some extent make sure that we are dealing with a list from
|
// To some extent make sure that we are dealing with a list from
|
||||||
// "getmatches()".
|
// "getmatches()".
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -14773,7 +14771,6 @@ static void f_setmatches(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
if (!match_add_failed) {
|
if (!match_add_failed) {
|
||||||
rettv->vval.v_number = 0;
|
rettv->vval.v_number = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -42,12 +42,6 @@ describe('NULL', function()
|
|||||||
describe('list', function()
|
describe('list', function()
|
||||||
-- Incorrect behaviour
|
-- Incorrect behaviour
|
||||||
|
|
||||||
-- FIXME should return 0
|
|
||||||
null_expr_test('is accepted by setqflist()', 'setqflist(L)', 0, -1)
|
|
||||||
-- FIXME should return 0
|
|
||||||
null_expr_test('is accepted by setloclist()', 'setloclist(1, L)', 0, -1)
|
|
||||||
-- FIXME should return 0
|
|
||||||
null_expr_test('is accepted by setmatches()', 'setmatches(L)', 0, -1)
|
|
||||||
-- FIXME should not error out
|
-- FIXME should not error out
|
||||||
null_test('is accepted by :cexpr', 'cexpr L', 'Vim(cexpr):E777: String or List expected')
|
null_test('is accepted by :cexpr', 'cexpr L', 'Vim(cexpr):E777: String or List expected')
|
||||||
-- FIXME should not error out
|
-- FIXME should not error out
|
||||||
@ -129,6 +123,9 @@ describe('NULL', function()
|
|||||||
'', '\n', function()
|
'', '\n', function()
|
||||||
eq({''}, curbufmeths.get_lines(0, -1, false))
|
eq({''}, curbufmeths.get_lines(0, -1, false))
|
||||||
end)
|
end)
|
||||||
|
null_expr_test('is accepted by setmatches()', 'setmatches(L)', 0, 0)
|
||||||
|
null_expr_test('is accepted by setqflist()', 'setqflist(L)', 0, 0)
|
||||||
|
null_expr_test('is accepted by setloclist()', 'setloclist(1, L)', 0, 0)
|
||||||
end)
|
end)
|
||||||
describe('dict', function()
|
describe('dict', function()
|
||||||
it('does not crash when indexing NULL dict', function()
|
it('does not crash when indexing NULL dict', function()
|
||||||
|
Loading…
Reference in New Issue
Block a user