aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_writefile.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-02-09 19:24:41 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-02-09 19:24:41 +0800
commit47a98ab3941fbb664879f67aa0270a9f93d2bed4 (patch)
tree3f5329a1d4071ac0503cf4cb3ce8b0d2bf678e93 /src/nvim/testdir/test_writefile.vim
parent92e43945627ac71ef160e3ecde1bf2913385c7d1 (diff)
downloadrneovim-47a98ab3941fbb664879f67aa0270a9f93d2bed4.tar.gz
rneovim-47a98ab3941fbb664879f67aa0270a9f93d2bed4.tar.bz2
rneovim-47a98ab3941fbb664879f67aa0270a9f93d2bed4.zip
vim-patch:8.2.2199: first write after setting 'eol' does not have NL added
Problem: First write after setting 'eol' does not have NL added. (Tomáš Janoušek) Solution: Only use b_no_eol_lnum when doing a binary write. (closes vim/vim#7535) https://github.com/vim/vim/commit/b3c8b1d25414f2e24ad03551cdf125b3e2c142b1
Diffstat (limited to 'src/nvim/testdir/test_writefile.vim')
-rw-r--r--src/nvim/testdir/test_writefile.vim18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_writefile.vim b/src/nvim/testdir/test_writefile.vim
index c69e8612c6..18e6f5e211 100644
--- a/src/nvim/testdir/test_writefile.vim
+++ b/src/nvim/testdir/test_writefile.vim
@@ -497,6 +497,24 @@ func Test_readwrite_file_with_bom()
%bw!
endfunc
+func Test_read_write_bin()
+ " write file missing EOL
+ call writefile(['noeol'], "XNoEolSetEol", 'bS')
+ call assert_equal(0z6E6F656F6C, readfile('XNoEolSetEol', 'B'))
+
+ " when file is read 'eol' is off
+ set ff=unix nofixeol
+ e XNoEolSetEol
+ call assert_equal(0, &eol)
+
+ " writing with 'eol' set adds the newline
+ setlocal eol
+ w
+ call assert_equal(0z6E6F656F6C0A, readfile('XNoEolSetEol', 'B'))
+
+ call delete('XNoEolSetEol')
+endfunc
+
" Check that buffer is written before triggering QuitPre
func Test_wq_quitpre_autocommand()
edit Xsomefile