diff options
-rw-r--r-- | src/nvim/testdir/test_writefile.vim | 2 | ||||
-rw-r--r-- | test/functional/eval/writefile_spec.lua | 21 |
2 files changed, 10 insertions, 13 deletions
diff --git a/src/nvim/testdir/test_writefile.vim b/src/nvim/testdir/test_writefile.vim index 13c1a888d9..8b031646b5 100644 --- a/src/nvim/testdir/test_writefile.vim +++ b/src/nvim/testdir/test_writefile.vim @@ -21,7 +21,7 @@ func Test_writefile_fails_gently() call assert_false(filereadable("Xfile")) call delete("Xfile") - call assert_fails('call writefile(["test", [], [], [], "tset"], "Xfile")', 'E730:') + call assert_fails('call writefile(["test", [], [], [], "tset"], "Xfile")', 'E745:') call assert_false(filereadable("Xfile")) call delete("Xfile") diff --git a/test/functional/eval/writefile_spec.lua b/test/functional/eval/writefile_spec.lua index 2f84114b9b..0bb7523d7e 100644 --- a/test/functional/eval/writefile_spec.lua +++ b/test/functional/eval/writefile_spec.lua @@ -127,23 +127,20 @@ describe('writefile()', function() eq('TEST', read_file(fname)) end) - it('stops writing to file after error in list', function() + it('does not write to file if error in list', function() local args = '["tset"] + repeat([%s], 3), "' .. fname .. '"' - eq('\nE806: using Float as a String', + eq('\nE805: Expected a Number or a String, Float found', redir_exec(('call writefile(%s)'):format(args:format('0.0')))) - eq('tset\n', read_file(fname)) + eq(nil, read_file(fname)) write_file(fname, 'TEST') - eq('\nE730: using List as a String', + eq('\nE745: Expected a Number or a String, List found', redir_exec(('call writefile(%s)'):format(args:format('[]')))) - eq('tset\n', read_file(fname)) - write_file(fname, 'TEST') - eq('\nE731: using Dictionary as a String', + eq('TEST', read_file(fname)) + eq('\nE728: Expected a Number or a String, Dictionary found', redir_exec(('call writefile(%s)'):format(args:format('{}')))) - eq('tset\n', read_file(fname)) - write_file(fname, 'TEST') - eq('\nE729: using Funcref as a String', + eq('TEST', read_file(fname)) + eq('\nE703: Expected a Number or a String, Funcref found', redir_exec(('call writefile(%s)'):format(args:format('function("tr")')))) - eq('tset\n', read_file(fname)) - write_file(fname, 'TEST') + eq('TEST', read_file(fname)) end) end) |