diff options
| author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-06-21 21:44:18 -0400 |
|---|---|---|
| committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-06-24 16:19:21 -0400 |
| commit | 39e284772d5ee7214341fce9e25f9d7e051dd39e (patch) | |
| tree | 17493843460c664651906fd168c45dfbff468a57 /src/nvim/testdir/test_writefile.vim | |
| parent | 38fb83585421c45828a4934fc75f7952b2baf116 (diff) | |
| download | rneovim-39e284772d5ee7214341fce9e25f9d7e051dd39e.tar.gz rneovim-39e284772d5ee7214341fce9e25f9d7e051dd39e.tar.bz2 rneovim-39e284772d5ee7214341fce9e25f9d7e051dd39e.zip | |
vim-patch:8.0.0642: writefile() continues after detecting an error
Problem: writefile() continues after detecting an error.
Solution: Bail out as soon as an error is detected. (suggestions by Nikolai
Pavlov, closes vim/vim#1476)
https://github.com/vim/vim/commit/8cf91286ca46a501d24e4b7d631b193256782c88
Diffstat (limited to 'src/nvim/testdir/test_writefile.vim')
| -rw-r--r-- | src/nvim/testdir/test_writefile.vim | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/nvim/testdir/test_writefile.vim b/src/nvim/testdir/test_writefile.vim index d820c580ac..13c1a888d9 100644 --- a/src/nvim/testdir/test_writefile.vim +++ b/src/nvim/testdir/test_writefile.vim @@ -1,5 +1,6 @@ +" Tests for the writefile() function. -function! Test_WriteFile() +func Test_writefile() let f = tempname() call writefile(["over","written"], f, "b") call writefile(["hello","world"], f, "b") @@ -13,4 +14,20 @@ function! Test_WriteFile() call assert_equal("morning", l[3]) call assert_equal("vimmers", l[4]) call delete(f) -endfunction +endfunc + +func Test_writefile_fails_gently() + call assert_fails('call writefile(["test"], "Xfile", [])', 'E730:') + call assert_false(filereadable("Xfile")) + call delete("Xfile") + + call assert_fails('call writefile(["test", [], [], [], "tset"], "Xfile")', 'E730:') + call assert_false(filereadable("Xfile")) + call delete("Xfile") + + call assert_fails('call writefile([], "Xfile", [])', 'E730:') + call assert_false(filereadable("Xfile")) + call delete("Xfile") + + call assert_fails('call writefile([], [])', 'E730:') +endfunc |