mirror of
https://github.com/neovim/neovim.git
synced 2025-09-25 04:28:33 +00:00
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.
18a2b87ca2
This commit is contained in:
@@ -11857,7 +11857,8 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (argvars[0].v_type != VAR_BLOB) {
|
} 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -17,6 +17,8 @@ func Test_writefile()
|
|||||||
call assert_equal("morning", l[3])
|
call assert_equal("morning", l[3])
|
||||||
call assert_equal("vimmers", l[4])
|
call assert_equal("vimmers", l[4])
|
||||||
call delete(f)
|
call delete(f)
|
||||||
|
|
||||||
|
call assert_fails('call writefile("text", "Xfile")', 'E475: Invalid argument: writefile() first argument must be a List or a Blob')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_writefile_ignore_regexp_error()
|
func Test_writefile_ignore_regexp_error()
|
||||||
|
@@ -119,7 +119,7 @@ describe('writefile()', function()
|
|||||||
eq('\nE118: Too many arguments for function: writefile',
|
eq('\nE118: Too many arguments for function: writefile',
|
||||||
redir_exec(('call writefile([], "%s", "b", 1)'):format(fname)))
|
redir_exec(('call writefile([], "%s", "b", 1)'):format(fname)))
|
||||||
for _, arg in ipairs({'0', '0.0', 'function("tr")', '{}', '"test"'}) do
|
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)))
|
redir_exec(('call writefile(%s, "%s", "b")'):format(arg, fname)))
|
||||||
end
|
end
|
||||||
for _, args in ipairs({'[], %s, "b"', '[], "' .. fname .. '", %s'}) do
|
for _, args in ipairs({'[], %s, "b"', '[], "' .. fname .. '", %s'}) do
|
||||||
|
Reference in New Issue
Block a user