mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
eval: Fix writefile()
This commit is contained in:
parent
21745d72b8
commit
5c1ddb5078
@ -17480,6 +17480,7 @@ static void f_winsaveview(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
/// @return true in case of success, false otherwise.
|
/// @return true in case of success, false otherwise.
|
||||||
static bool write_list(FileDescriptor *const fp, const list_T *const list,
|
static bool write_list(FileDescriptor *const fp, const list_T *const list,
|
||||||
const bool binary)
|
const bool binary)
|
||||||
|
FUNC_ATTR_NONNULL_ARG(1)
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
TV_LIST_ITER_CONST(list, li, {
|
TV_LIST_ITER_CONST(list, li, {
|
||||||
@ -17645,9 +17646,6 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
EMSG2(_(e_listarg), "writefile()");
|
EMSG2(_(e_listarg), "writefile()");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (argvars[0].vval.v_list == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool binary = false;
|
bool binary = false;
|
||||||
bool append = false;
|
bool append = false;
|
||||||
|
@ -42,10 +42,6 @@ describe('NULL', function()
|
|||||||
describe('list', function()
|
describe('list', function()
|
||||||
-- Incorrect behaviour
|
-- Incorrect behaviour
|
||||||
|
|
||||||
-- FIXME should be accepted by writefile(), return {0, {}}
|
|
||||||
null_expr_test('is accepted as an empty list by writefile()',
|
|
||||||
('[writefile(L, "%s"), readfile("%s")]'):format(tmpfname, tmpfname),
|
|
||||||
'E484: Can\'t open file ' .. tmpfname, {0, {}})
|
|
||||||
-- FIXME should return 0
|
-- FIXME should return 0
|
||||||
null_expr_test('is accepted by setqflist()', 'setqflist(L)', 0, -1)
|
null_expr_test('is accepted by setqflist()', 'setqflist(L)', 0, -1)
|
||||||
-- FIXME should return 0
|
-- FIXME should return 0
|
||||||
@ -104,6 +100,9 @@ describe('NULL', function()
|
|||||||
null_expr_test('makes filter() return v:_null_list', 'filter(L, "1") is# L', 0, 1)
|
null_expr_test('makes filter() return v:_null_list', 'filter(L, "1") is# L', 0, 1)
|
||||||
null_test('is treated by :let as empty list', ':let [l] = L', 'Vim(let):E688: More targets than List items')
|
null_test('is treated by :let as empty list', ':let [l] = L', 'Vim(let):E688: More targets than List items')
|
||||||
null_expr_test('is accepted as an empty list by inputlist()', '[feedkeys("\\n"), inputlist(L)]', 0, 0)
|
null_expr_test('is accepted as an empty list by inputlist()', '[feedkeys("\\n"), inputlist(L)]', 0, 0)
|
||||||
|
null_expr_test('is accepted as an empty list by writefile()',
|
||||||
|
('[writefile(L, "%s"), readfile("%s")]'):format(tmpfname, tmpfname),
|
||||||
|
0, {0, {}})
|
||||||
-- FIXME fix test results
|
-- FIXME fix test results
|
||||||
null_expr_test('does not crash add()', 'add(L, 0)', 0, 1)
|
null_expr_test('does not crash add()', 'add(L, 0)', 0, 1)
|
||||||
null_expr_test('makes insert() error out', 'insert(L, 1)', '', nil)
|
null_expr_test('makes insert() error out', 'insert(L, 1)', '', nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user