comparison src/testdir/test_fixeol.vim @ 12851:90aaa974594e v8.0.1302

patch 8.0.1302: still too many old style tests commit https://github.com/vim/vim/commit/209d3874c19d73b209e7d223cf05ea22e183f408 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 16 21:52:51 2017 +0100 patch 8.0.1302: still too many old style tests Problem: Still too many old style tests. Solution: Convert a few more tests to new style. (Yegappan Lakshmanan, closes #2326)
author Christian Brabandt <cb@256bit.org>
date Thu, 16 Nov 2017 22:00:03 +0100
parents
children 08940efa6b4e
comparison
equal deleted inserted replaced
12850:3064e2b6ca3b 12851:90aaa974594e
1 " Tests for 'fixeol' and 'eol'
2 func Test_fixeol()
3 " first write two test files – with and without trailing EOL
4 " use Unix fileformat for consistency
5 set ff=unix
6 enew!
7 call setline('.', 'with eol')
8 w! XXEol
9 enew!
10 set noeol nofixeol
11 call setline('.', 'without eol')
12 w! XXNoEol
13 set eol fixeol
14 bwipe XXEol XXNoEol
15
16 " try editing files with 'fixeol' disabled
17 e! XXEol
18 normal ostays eol
19 set nofixeol
20 w! XXTestEol
21 e! XXNoEol
22 normal ostays without
23 set nofixeol
24 w! XXTestNoEol
25 bwipe! XXEol XXNoEol XXTestEol XXTestNoEol
26 set fixeol
27
28 " Append "END" to each file so that we can see what the last written char
29 " was.
30 normal ggdGaEND
31 w >>XXEol
32 w >>XXNoEol
33 w >>XXTestEol
34 w >>XXTestNoEol
35
36 call assert_equal(['with eol', 'END'], readfile('XXEol'))
37 call assert_equal(['without eolEND'], readfile('XXNoEol'))
38 call assert_equal(['with eol', 'stays eol', 'END'], readfile('XXTestEol'))
39 call assert_equal(['without eol', 'stays withoutEND'],
40 \ readfile('XXTestNoEol'))
41
42 call delete('XXEol')
43 call delete('XXNoEol')
44 call delete('XXTestEol')
45 call delete('XXTestNoEol')
46 set ff& fixeol& eol&
47 enew!
48 endfunc