blob: 256a7d5b1cdcffffe9d7eb90c97eec218a13dfad [file] [log] [blame]
Bram Moolenaare8ef3a02016-10-12 17:45:29 +02001" Test behavior of fileformat after bwipeout of last buffer
2
3func Test_fileformat_after_bw()
4 bwipeout
5 set fileformat&
6 if &fileformat == 'dos'
7 let test_fileformats = 'unix'
8 elseif &fileformat == 'unix'
9 let test_fileformats = 'mac'
10 else " must be mac
11 let test_fileformats = 'dos'
12 endif
13 exec 'set fileformats='.test_fileformats
14 bwipeout!
15 call assert_equal(test_fileformats, &fileformat)
16 set fileformats&
17endfunc
Bram Moolenaar7a2699e2017-01-23 21:31:09 +010018
19func Test_fileformat_autocommand()
20 let filecnt=['', 'foobar', 'eins', '', 'zwei', 'drei', 'vier', 'fünf', '']
21 let ffs=&ffs
22 call writefile(filecnt, 'Xfile', 'b')
23 au BufReadPre Xfile set ffs=dos ff=dos
24 new Xfile
25 call assert_equal('dos', &l:ff)
26 call assert_equal('dos', &ffs)
27 " cleanup
28 let &ffs=ffs
29 au! BufReadPre Xfile
30 bw!
31endfunc