annotate src/testdir/test_fileformat.vim @ 10672:0a6c66a06fdb v8.0.0226

patch 8.0.0226: test for patch 8.0.0224 missing CR characters commit https://github.com/vim/vim/commit/1695f99d08076d77ed3015f1edf09a668a4d449a Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 24 13:18:43 2017 +0100 patch 8.0.0226: test for patch 8.0.0224 missing CR characters Problem: The test for patch 8.0.0224 misses the CR characters and passes even without the fix. (Christian Brabandt) Solution: Use double quotes and \<CR>.
author Christian Brabandt <cb@256bit.org>
date Tue, 24 Jan 2017 13:30:04 +0100
parents 6a252c6afd5b
children d6857a8dc07e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10268
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test behavior of fileformat after bwipeout of last buffer
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_fileformat_after_bw()
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 bwipeout
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 set fileformat&
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 if &fileformat == 'dos'
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 let test_fileformats = 'unix'
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 elseif &fileformat == 'unix'
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 let test_fileformats = 'mac'
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 else " must be mac
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 let test_fileformats = 'dos'
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 endif
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 exec 'set fileformats='.test_fileformats
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 bwipeout!
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 call assert_equal(test_fileformats, &fileformat)
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 set fileformats&
c55a7232fb48 commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 endfunc
10668
6a252c6afd5b patch 8.0.0224: change to 'fileformats' from autocmd does not take effect
Christian Brabandt <cb@256bit.org>
parents: 10268
diff changeset
18
6a252c6afd5b patch 8.0.0224: change to 'fileformats' from autocmd does not take effect
Christian Brabandt <cb@256bit.org>
parents: 10268
diff changeset
19 func Test_fileformat_autocommand()
10672
0a6c66a06fdb patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents: 10668
diff changeset
20 let filecnt = ["\<CR>", "foobar\<CR>", "eins\<CR>", "\<CR>", "zwei\<CR>", "drei", "vier", "fünf", ""]
0a6c66a06fdb patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents: 10668
diff changeset
21 let ffs = &ffs
0a6c66a06fdb patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents: 10668
diff changeset
22 call writefile(filecnt, 'Xfile', 'b')
0a6c66a06fdb patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents: 10668
diff changeset
23 au BufReadPre Xfile set ffs=dos ff=dos
0a6c66a06fdb patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents: 10668
diff changeset
24 new Xfile
0a6c66a06fdb patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents: 10668
diff changeset
25 call assert_equal('dos', &l:ff)
0a6c66a06fdb patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents: 10668
diff changeset
26 call assert_equal('dos', &ffs)
0a6c66a06fdb patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents: 10668
diff changeset
27
0a6c66a06fdb patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents: 10668
diff changeset
28 " cleanup
0a6c66a06fdb patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents: 10668
diff changeset
29 call delete('Xfile')
0a6c66a06fdb patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents: 10668
diff changeset
30 let &ffs = ffs
0a6c66a06fdb patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents: 10668
diff changeset
31 au! BufReadPre Xfile
0a6c66a06fdb patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents: 10668
diff changeset
32 bw!
10668
6a252c6afd5b patch 8.0.0224: change to 'fileformats' from autocmd does not take effect
Christian Brabandt <cb@256bit.org>
parents: 10268
diff changeset
33 endfunc