diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-02 15:27:06 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-09-15 22:57:54 +0100 |
commit | ba34afb37849a8bdf5d601ced7f3c139a80cd396 (patch) | |
tree | 6e6a6d97f78e7b48e02f572bdfa28103cface896 | |
parent | 53f28f024c90399106aac5c006e4fd0dd605b564 (diff) | |
download | rneovim-ba34afb37849a8bdf5d601ced7f3c139a80cd396.tar.gz rneovim-ba34afb37849a8bdf5d601ced7f3c139a80cd396.tar.bz2 rneovim-ba34afb37849a8bdf5d601ced7f3c139a80cd396.zip |
vim-patch:8.2.0404: writefile() error does not give a hint
Problem: Writefile() error does not give a hint.
Solution: Add remark about first argument.
https://github.com/vim/vim/commit/18a2b87ca27c378a555b20f14a284d2ce3511427
-rw-r--r-- | src/nvim/eval/funcs.c | 3 | ||||
-rw-r--r-- | src/nvim/testdir/test_writefile.vim | 2 | ||||
-rw-r--r-- | test/functional/eval/writefile_spec.lua | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 2d58ce1d04..6dd7a92b61 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -11857,7 +11857,8 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr) } }); } else if (argvars[0].v_type != VAR_BLOB) { - EMSG2(_(e_invarg2), "writefile()"); + EMSG2(_(e_invarg2), + _("writefile() first argument must be a List or a Blob")); return; } diff --git a/src/nvim/testdir/test_writefile.vim b/src/nvim/testdir/test_writefile.vim index 6922e2185d..2504fcb14e 100644 --- a/src/nvim/testdir/test_writefile.vim +++ b/src/nvim/testdir/test_writefile.vim @@ -17,6 +17,8 @@ func Test_writefile() call assert_equal("morning", l[3]) call assert_equal("vimmers", l[4]) call delete(f) + + call assert_fails('call writefile("text", "Xfile")', 'E475: Invalid argument: writefile() first argument must be a List or a Blob') endfunc func Test_writefile_ignore_regexp_error() diff --git a/test/functional/eval/writefile_spec.lua b/test/functional/eval/writefile_spec.lua index b2a601a767..14be8c377c 100644 --- a/test/functional/eval/writefile_spec.lua +++ b/test/functional/eval/writefile_spec.lua @@ -119,7 +119,7 @@ describe('writefile()', function() eq('\nE118: Too many arguments for function: writefile', redir_exec(('call writefile([], "%s", "b", 1)'):format(fname))) for _, arg in ipairs({'0', '0.0', 'function("tr")', '{}', '"test"'}) do - eq('\nE475: Invalid argument: writefile()', + eq('\nE475: Invalid argument: writefile() first argument must be a List or a Blob', redir_exec(('call writefile(%s, "%s", "b")'):format(arg, fname))) end for _, args in ipairs({'[], %s, "b"', '[], "' .. fname .. '", %s'}) do |