1" Tests for 'fixeol' and 'eol' 2 3func Test_fixeol() 4 " first write two test files – with and without trailing EOL 5 " use Unix fileformat for consistency 6 set ff=unix 7 enew! 8 call setline('.', 'with eol') 9 w! XXEol 10 enew! 11 set noeol nofixeol 12 call setline('.', 'without eol') 13 w! XXNoEol 14 set eol fixeol 15 bwipe XXEol XXNoEol 16 17 " try editing files with 'fixeol' disabled 18 e! XXEol 19 normal ostays eol 20 set nofixeol 21 w! XXTestEol 22 e! XXNoEol 23 normal ostays without 24 set nofixeol 25 w! XXTestNoEol 26 bwipe! XXEol XXNoEol XXTestEol XXTestNoEol 27 set fixeol 28 29 " Append "END" to each file so that we can see what the last written char 30 " was. 31 normal ggdGaEND 32 w >>XXEol 33 w >>XXNoEol 34 w >>XXTestEol 35 w >>XXTestNoEol 36 37 call assert_equal(['with eol', 'END'], readfile('XXEol')) 38 call assert_equal(['without eolEND'], readfile('XXNoEol')) 39 call assert_equal(['with eol', 'stays eol', 'END'], readfile('XXTestEol')) 40 call assert_equal(['without eol', 'stays withoutEND'], 41 \ readfile('XXTestNoEol')) 42 43 call delete('XXEol') 44 call delete('XXNoEol') 45 call delete('XXTestEol') 46 call delete('XXTestNoEol') 47 set ff& fixeol& eol& 48 enew! 49endfunc 50 51" vim: shiftwidth=2 sts=2 expandtab 52