aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-12-10 03:54:21 +0300
committerZyX <kp-pav@yandex.ru>2017-12-10 04:00:54 +0300
commit5c1ddb5078c90f69c7225a7b2e74ccb914dcdd6a (patch)
treebe4f3d0bb5af6d12dd5eda294dd0649b8f44f354
parent21745d72b8c24c7f19dea5d53384da4875c43e74 (diff)
downloadrneovim-5c1ddb5078c90f69c7225a7b2e74ccb914dcdd6a.tar.gz
rneovim-5c1ddb5078c90f69c7225a7b2e74ccb914dcdd6a.tar.bz2
rneovim-5c1ddb5078c90f69c7225a7b2e74ccb914dcdd6a.zip
eval: Fix writefile()
-rw-r--r--src/nvim/eval.c4
-rw-r--r--test/functional/eval/null_spec.lua7
2 files changed, 4 insertions, 7 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index da953999cc..2f908f70a9 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -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;
diff --git a/test/functional/eval/null_spec.lua b/test/functional/eval/null_spec.lua
index 20f9c70a41..7452185208 100644
--- a/test/functional/eval/null_spec.lua
+++ b/test/functional/eval/null_spec.lua
@@ -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)