patch 8.2.2873: not enough tests for writing buffers
Problem: Not enough tests for writing buffers.
Solution: Add a few more tests. (Yegappan Lakshmanan, closes #8229)
diff --git a/src/testdir/test_writefile.vim b/src/testdir/test_writefile.vim
index 75dda81..e4293e3 100644
--- a/src/testdir/test_writefile.vim
+++ b/src/testdir/test_writefile.vim
@@ -471,7 +471,7 @@
" Root can do it too.
CheckNotRoot
- call mkdir('Xdir')
+ call mkdir('Xdir/')
call writefile(['one'], 'Xdir/Xfile1')
call setfperm('Xdir', 'r-xr--r--')
" try to create a new file in the directory
@@ -754,7 +754,7 @@
call assert_equal(0z6E6F656F6C0A, readfile('XNoEolSetEol', 'B'))
call delete('XNoEolSetEol')
- set ff&
+ set ff& fixeol&
bwipe! XNoEolSetEol
endfunc
@@ -897,4 +897,22 @@
call delete('Xfile.bak')
endfunc
+" Test for ':write ++bin' and ':write ++nobin'
+func Test_write_binary_file()
+ " create a file without an eol/eof character
+ call writefile(0z616161, 'Xfile1', 'b')
+ new Xfile1
+ write ++bin Xfile2
+ write ++nobin Xfile3
+ call assert_equal(0z616161, readblob('Xfile2'))
+ if has('win32')
+ call assert_equal(0z6161610D.0A, readblob('Xfile3'))
+ else
+ call assert_equal(0z6161610A, readblob('Xfile3'))
+ endif
+ call delete('Xfile1')
+ call delete('Xfile2')
+ call delete('Xfile3')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab