aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-18 22:12:53 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-19 10:39:14 -0500
commit09b7163f5d942339475a4977253920c4ae7e1297 (patch)
tree571a57158551138b550155d9bbe4cda4e5340e63 /src
parent46afc1def8ea1b686f96a20711aef96b7f4fd122 (diff)
downloadrneovim-09b7163f5d942339475a4977253920c4ae7e1297.tar.gz
rneovim-09b7163f5d942339475a4977253920c4ae7e1297.tar.bz2
rneovim-09b7163f5d942339475a4977253920c4ae7e1297.zip
vim-patch:8.2.0262: fileformat test fails on MS-Windows
Problem: Fileformat test fails on MS-Windows. Solution: Set fileformat of buffer. https://github.com/vim/vim/commit/50434bd74c7708e3e2a47449b6a3a8d9fa069f71 Cherry-pick Test_fileformat_plusplus_read() from patch v8.2.0261.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/testdir/test_fileformat.vim23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_fileformat.vim b/src/nvim/testdir/test_fileformat.vim
index 8dc25f62b1..3de7d38831 100644
--- a/src/nvim/testdir/test_fileformat.vim
+++ b/src/nvim/testdir/test_fileformat.vim
@@ -31,3 +31,26 @@ func Test_fileformat_autocommand()
au! BufReadPre Xfile
bw!
endfunc
+
+" Test for changing the fileformat using ++read
+func Test_fileformat_plusplus_read()
+ new
+ call setline(1, ['one', 'two', 'three'])
+ set ff=unix
+ w ++ff=dos Xfile1
+ enew!
+ " A :read doesn't change the fileformat, but does apply to the read lines.
+ r ++fileformat=unix Xfile1
+ call assert_equal('unix', &fileformat)
+ call assert_equal("three\r", getline('$'))
+ 3r ++edit Xfile1
+ call assert_equal('dos', &fileformat)
+ close!
+ call delete('Xfile1')
+ set fileformat&
+ call assert_fails('e ++fileformat Xfile1', 'E474:')
+ call assert_fails('e ++ff=abc Xfile1', 'E474:')
+ call assert_fails('e ++abc1 Xfile1', 'E474:')
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab