summaryrefslogtreecommitdiff
path: root/src/testdir/test_fileformat.vim
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2021-06-16 15:53:17 +0200
committerBram Moolenaar <Bram@vim.org>2021-06-16 15:53:17 +0200
commit41a7f82dea525b3398bf372cbb9c268455845800 (patch)
tree01a3109d33f0599628a340a4667bd747a488c094 /src/testdir/test_fileformat.vim
parentb90ac5e96e40706ffb039db64b92fcd16fa78c04 (diff)
downloadvim-git-41a7f82dea525b3398bf372cbb9c268455845800.tar.gz
patch 8.2.3010: not enough testing for viminfo codev8.2.3010
Problem: Not enough testing for viminfo code. Solution: Add a few more tests. (Yegappan Lakshmanan, closes #8390)
Diffstat (limited to 'src/testdir/test_fileformat.vim')
-rw-r--r--src/testdir/test_fileformat.vim16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/testdir/test_fileformat.vim b/src/testdir/test_fileformat.vim
index 07819dc2e..6ba6e49ad 100644
--- a/src/testdir/test_fileformat.vim
+++ b/src/testdir/test_fileformat.vim
@@ -1,5 +1,7 @@
" Test for 'fileformat'
+source shared.vim
+
" Test behavior of fileformat after bwipeout of last buffer
func Test_fileformat_after_bw()
bwipeout
@@ -308,4 +310,18 @@ func Test_fileformat_plusplus_read()
call assert_fails('e ++abc1 Xfile1', 'E474:')
endfunc
+" When Vim starts up with an empty buffer the first item in 'fileformats' is
+" used as the 'fileformat'.
+func Test_fileformat_on_startup()
+ let after =<< trim END
+ call writefile([&fileformat], 'Xfile', 'a')
+ quit
+ END
+ call RunVim(["set ffs=dos,unix,mac"], after, '')
+ call RunVim(["set ffs=mac,dos,unix"], after, '')
+ call RunVim(["set ffs=unix,mac,dos"], after, '')
+ call assert_equal(['dos', 'mac', 'unix'], readfile('Xfile'))
+ call delete('Xfile')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab