From 09b7163f5d942339475a4977253920c4ae7e1297 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 18 Dec 2020 22:12:53 -0500 Subject: 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. --- src/nvim/testdir/test_fileformat.vim | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src') 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 -- cgit