From 7e8212c459b285aacf2dd225c1dad5593314f094 Mon Sep 17 00:00:00 2001 From: ckelsel Date: Fri, 10 Nov 2017 23:17:20 +0800 Subject: vim-patch:8.0.0224 Problem: When 'fileformats' is changed in a BufReadPre auto command, it does not take effect in readfile(). (Gary Johnson) Solution: Check the value of 'fileformats' after executing auto commands. (Christian Brabandt) https://github.com/vim/vim/commit/7a2699e868bca781e26b060a44fc714d87cfa4ba --- src/nvim/testdir/test_fileformat.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_fileformat.vim b/src/nvim/testdir/test_fileformat.vim index 584f20cdfc..256a7d5b1c 100644 --- a/src/nvim/testdir/test_fileformat.vim +++ b/src/nvim/testdir/test_fileformat.vim @@ -15,3 +15,17 @@ func Test_fileformat_after_bw() call assert_equal(test_fileformats, &fileformat) set fileformats& endfunc + +func Test_fileformat_autocommand() + let filecnt=['', 'foobar', 'eins', '', 'zwei', 'drei', 'vier', 'fünf', ''] + let ffs=&ffs + call writefile(filecnt, 'Xfile', 'b') + au BufReadPre Xfile set ffs=dos ff=dos + new Xfile + call assert_equal('dos', &l:ff) + call assert_equal('dos', &ffs) + " cleanup + let &ffs=ffs + au! BufReadPre Xfile + bw! +endfunc -- cgit From 67a2207c4a4d9b848a4759a7f1e11b5ad1265648 Mon Sep 17 00:00:00 2001 From: ckelsel Date: Fri, 10 Nov 2017 23:28:58 +0800 Subject: vim-patch:8.0.0226 Problem: The test for patch 8.0.0224 misses the CR characters and passes even without the fix. (Christian Brabandt) Solution: Use double quotes and \. https://github.com/vim/vim/commit/1695f99d08076d77ed3015f1edf09a668a4d449a --- src/nvim/testdir/test_fileformat.vim | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_fileformat.vim b/src/nvim/testdir/test_fileformat.vim index 256a7d5b1c..de505d3bd0 100644 --- a/src/nvim/testdir/test_fileformat.vim +++ b/src/nvim/testdir/test_fileformat.vim @@ -17,15 +17,17 @@ func Test_fileformat_after_bw() endfunc func Test_fileformat_autocommand() - let filecnt=['', 'foobar', 'eins', '', 'zwei', 'drei', 'vier', 'fünf', ''] - let ffs=&ffs - call writefile(filecnt, 'Xfile', 'b') - au BufReadPre Xfile set ffs=dos ff=dos - new Xfile - call assert_equal('dos', &l:ff) - call assert_equal('dos', &ffs) - " cleanup - let &ffs=ffs - au! BufReadPre Xfile - bw! + let filecnt = ["\", "foobar\", "eins\", "\", "zwei\", "drei", "vier", "fünf", ""] + let ffs = &ffs + call writefile(filecnt, 'Xfile', 'b') + au BufReadPre Xfile set ffs=dos ff=dos + new Xfile + call assert_equal('dos', &l:ff) + call assert_equal('dos', &ffs) + + " cleanup + call delete('Xfile') + let &ffs = ffs + au! BufReadPre Xfile + bw! endfunc -- cgit