aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_writefile.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-07 07:21:46 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-11-07 07:33:59 +0800
commit7e1d9c560b09cacb78b2fc8f9428a77d6fca66e1 (patch)
treec1c6e5463d515ddc174ca71554d1203f29983c28 /src/nvim/testdir/test_writefile.vim
parentbdf87efeb523aecffde7dbf3c17806f7ca98471f (diff)
downloadrneovim-7e1d9c560b09cacb78b2fc8f9428a77d6fca66e1.tar.gz
rneovim-7e1d9c560b09cacb78b2fc8f9428a77d6fca66e1.tar.bz2
rneovim-7e1d9c560b09cacb78b2fc8f9428a77d6fca66e1.zip
vim-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 vim/vim#8229) https://github.com/vim/vim/commit/46aa6f93acb5d932d2893606d980a6b4b8a9594c Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/testdir/test_writefile.vim')
-rw-r--r--src/nvim/testdir/test_writefile.vim22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/nvim/testdir/test_writefile.vim b/src/nvim/testdir/test_writefile.vim
index b80519f316..81615b5963 100644
--- a/src/nvim/testdir/test_writefile.vim
+++ b/src/nvim/testdir/test_writefile.vim
@@ -484,7 +484,7 @@ func Test_write_readonly_dir()
" 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
@@ -768,7 +768,7 @@ func Test_read_write_bin()
call assert_equal(0z6E6F656F6C0A, readfile('XNoEolSetEol', 'B'))
call delete('XNoEolSetEol')
- set ff&
+ set ff& fixeol&
bwipe! XNoEolSetEol
endfunc
@@ -911,6 +911,24 @@ func Test_write_backup_symlink()
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
+
" Check that buffer is written before triggering QuitPre
func Test_wq_quitpre_autocommand()
edit Xsomefile