eval: Fix writefile()

This commit is contained in:
ZyX 2017-12-10 03:54:21 +03:00
parent 21745d72b8
commit 5c1ddb5078
2 changed files with 4 additions and 7 deletions

View File

@ -17480,6 +17480,7 @@ static void f_winsaveview(typval_T *argvars, typval_T *rettv, FunPtr fptr)
/// @return true in case of success, false otherwise.
static bool write_list(FileDescriptor *const fp, const list_T *const list,
const bool binary)
FUNC_ATTR_NONNULL_ARG(1)
{
int error = 0;
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()");
return;
}
if (argvars[0].vval.v_list == NULL) {
return;
}
bool binary = false;
bool append = false;

View File

@ -42,10 +42,6 @@ describe('NULL', function()
describe('list', function()
-- 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
null_expr_test('is accepted by setqflist()', 'setqflist(L)', 0, -1)
-- 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_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 writefile()',
('[writefile(L, "%s"), readfile("%s")]'):format(tmpfname, tmpfname),
0, {0, {}})
-- FIXME fix test results
null_expr_test('does not crash add()', 'add(L, 0)', 0, 1)
null_expr_test('makes insert() error out', 'insert(L, 1)', '', nil)