aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_fileformat.vim
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-19 15:18:33 -0500
committerGitHub <noreply@github.com>2020-12-19 15:18:33 -0500
commit7e4c912565f1dc00a873cff14ca435af9796cd4c (patch)
treeea1a4d1e0e4e62b361cdaaf19f6e45512b89e781 /src/nvim/testdir/test_fileformat.vim
parentf12bbf62cc2d39d99e700029dfa61b39ea8e8746 (diff)
parentfb0ecf9e70872bc43399f961f0235fbf67d19966 (diff)
downloadrneovim-7e4c912565f1dc00a873cff14ca435af9796cd4c.tar.gz
rneovim-7e4c912565f1dc00a873cff14ca435af9796cd4c.tar.bz2
rneovim-7e4c912565f1dc00a873cff14ca435af9796cd4c.zip
Merge pull request #13559 from janlazo/vim-8.2.0162
vim-patch:8.1.1657,8.2.{162,262,264,272}
Diffstat (limited to 'src/nvim/testdir/test_fileformat.vim')
-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..465613f1cf 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'])
+ w ++ff=dos Xfile1
+ enew!
+ set ff=unix
+ " 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