Bram Moolenaar | e8ef3a0 | 2016-10-12 17:45:29 +0200 | [diff] [blame] | 1 | " Test behavior of fileformat after bwipeout of last buffer |
| 2 | |
| 3 | func 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& |
| 17 | endfunc |
Bram Moolenaar | 7a2699e | 2017-01-23 21:31:09 +0100 | [diff] [blame^] | 18 | |
| 19 | func 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! |
| 31 | endfunc |