Mercurial > vim
annotate src/testdir/test_fileformat.vim @ 31604:9b13b3a63bc0 v9.0.1134
patch 9.0.1134: comparing objects uses identity instead of equality
Commit: https://github.com/vim/vim/commit/bcf31ec36b4b056bf06d21036640c6f0235e9c2b
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jan 2 20:32:24 2023 +0000
patch 9.0.1134: comparing objects uses identity instead of equality
Problem: Comparing objects uses identity instead of equality.
Solution: Compare the object values.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 02 Jan 2023 21:45:02 +0100 |
parents | a52697bcffa6 |
children |
rev | line source |
---|---|
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
19413
diff
changeset
|
1 " Test for 'fileformat' |
16821
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
2 |
24946
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
3 source shared.vim |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
4 |
10268
c55a7232fb48
commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 " 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
|
6 func Test_fileformat_after_bw() |
c55a7232fb48
commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 bwipeout |
c55a7232fb48
commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 set fileformat& |
c55a7232fb48
commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 if &fileformat == 'dos' |
c55a7232fb48
commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 let test_fileformats = 'unix' |
c55a7232fb48
commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 elseif &fileformat == 'unix' |
c55a7232fb48
commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 let test_fileformats = 'mac' |
c55a7232fb48
commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 else " must be mac |
c55a7232fb48
commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 let test_fileformats = 'dos' |
c55a7232fb48
commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 endif |
c55a7232fb48
commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 exec 'set fileformats='.test_fileformats |
c55a7232fb48
commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 bwipeout! |
c55a7232fb48
commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call assert_equal(test_fileformats, &fileformat) |
c55a7232fb48
commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 set fileformats& |
c55a7232fb48
commit https://github.com/vim/vim/commit/e8ef3a093453b73594e15462d4de50b011c8ba66
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 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
|
21 |
6a252c6afd5b
patch 8.0.0224: change to 'fileformats' from autocmd does not take effect
Christian Brabandt <cb@256bit.org>
parents:
10268
diff
changeset
|
22 func Test_fileformat_autocommand() |
10674
d6857a8dc07e
patch 8.0.0227: crash with ff=dos when first line in file has no CR
Christian Brabandt <cb@256bit.org>
parents:
10672
diff
changeset
|
23 let filecnt = ["", "foobar\<CR>", "eins\<CR>", "\<CR>", "zwei\<CR>", "drei", "vier", "fünf", ""] |
10672
0a6c66a06fdb
patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents:
10668
diff
changeset
|
24 let ffs = &ffs |
30552
a7a9e8b9af89
patch 9.0.0611: tests delete files with a separate delete() call
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
25 call writefile(filecnt, 'Xffafile', 'bD') |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
24946
diff
changeset
|
26 au BufReadPre Xffafile set ffs=dos ff=dos |
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
24946
diff
changeset
|
27 new Xffafile |
10672
0a6c66a06fdb
patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents:
10668
diff
changeset
|
28 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
|
29 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
|
30 |
0a6c66a06fdb
patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents:
10668
diff
changeset
|
31 " cleanup |
0a6c66a06fdb
patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents:
10668
diff
changeset
|
32 let &ffs = ffs |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
24946
diff
changeset
|
33 au! BufReadPre Xffafile |
10672
0a6c66a06fdb
patch 8.0.0226: test for patch 8.0.0224 missing CR characters
Christian Brabandt <cb@256bit.org>
parents:
10668
diff
changeset
|
34 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
|
35 endfunc |
16821
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
36 |
24101
6d3dee0d7de5
patch 8.2.2592: code coverage could be improved
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
37 func Test_fileformat_nomodifiable() |
6d3dee0d7de5
patch 8.2.2592: code coverage could be improved
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
38 new |
6d3dee0d7de5
patch 8.2.2592: code coverage could be improved
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
39 setlocal nomodifiable |
6d3dee0d7de5
patch 8.2.2592: code coverage could be improved
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
40 |
6d3dee0d7de5
patch 8.2.2592: code coverage could be improved
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
41 call assert_fails('set fileformat=latin1', 'E21:') |
6d3dee0d7de5
patch 8.2.2592: code coverage could be improved
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
42 |
6d3dee0d7de5
patch 8.2.2592: code coverage could be improved
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
43 bw |
6d3dee0d7de5
patch 8.2.2592: code coverage could be improved
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
44 endfunc |
6d3dee0d7de5
patch 8.2.2592: code coverage could be improved
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
45 |
16821
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
46 " Convert the contents of a file into a literal string |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
47 func s:file2str(fname) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
48 let b = readfile(a:fname, 'B') |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
49 let s = '' |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
50 for c in b |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
51 let s .= nr2char(c) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
52 endfor |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
53 return s |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
54 endfunc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
55 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
56 " Concatenate the contents of files 'f1' and 'f2' and create 'destfile' |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
57 func s:concat_files(f1, f2, destfile) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
58 let b1 = readfile(a:f1, 'B') |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
59 let b2 = readfile(a:f2, 'B') |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
60 let b3 = b1 + b2 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
61 call writefile(b3, a:destfile, 'B') |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
62 endfun |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
63 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
64 " Test for a lot of variations of the 'fileformats' option |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
65 func Test_fileformats() |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
66 " create three test files, one in each format |
30552
a7a9e8b9af89
patch 9.0.0611: tests delete files with a separate delete() call
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
67 call writefile(['unix', 'unix'], 'XXUnix', 'D') |
a7a9e8b9af89
patch 9.0.0611: tests delete files with a separate delete() call
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
68 call writefile(["dos\r", "dos\r"], 'XXDos', 'D') |
a7a9e8b9af89
patch 9.0.0611: tests delete files with a separate delete() call
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
69 call writefile(["mac\rmac\r"], 'XXMac', 'bD') |
16821
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
70 " create a file with no End Of Line |
30552
a7a9e8b9af89
patch 9.0.0611: tests delete files with a separate delete() call
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
71 call writefile(["noeol"], 'XXEol', 'bD') |
16821
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
72 " create mixed format files |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
73 call s:concat_files('XXUnix', 'XXDos', 'XXUxDs') |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
74 call s:concat_files('XXUnix', 'XXMac', 'XXUxMac') |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
75 call s:concat_files('XXDos', 'XXMac', 'XXDosMac') |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
76 call s:concat_files('XXMac', 'XXEol', 'XXMacEol') |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
77 call s:concat_files('XXUxDs', 'XXMac', 'XXUxDsMc') |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
78 |
31140
a52697bcffa6
patch 9.0.0904: various comment and indent flaws
Bram Moolenaar <Bram@vim.org>
parents:
30552
diff
changeset
|
79 " The :bwipe commands below cause us to get back to the current buffer. |
a52697bcffa6
patch 9.0.0904: various comment and indent flaws
Bram Moolenaar <Bram@vim.org>
parents:
30552
diff
changeset
|
80 " Avoid stray errors for various 'fileformat' values which may cause a |
a52697bcffa6
patch 9.0.0904: various comment and indent flaws
Bram Moolenaar <Bram@vim.org>
parents:
30552
diff
changeset
|
81 " modeline to be misinterpreted by wiping the buffer and editing a new one. |
a52697bcffa6
patch 9.0.0904: various comment and indent flaws
Bram Moolenaar <Bram@vim.org>
parents:
30552
diff
changeset
|
82 only! |
a52697bcffa6
patch 9.0.0904: various comment and indent flaws
Bram Moolenaar <Bram@vim.org>
parents:
30552
diff
changeset
|
83 bwipe! |
a52697bcffa6
patch 9.0.0904: various comment and indent flaws
Bram Moolenaar <Bram@vim.org>
parents:
30552
diff
changeset
|
84 enew |
16821
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
85 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
86 " Test 1: try reading and writing with 'fileformats' empty |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
87 set fileformats= |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
88 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
89 " try with 'fileformat' set to 'unix' |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
90 set fileformat=unix |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
91 e! XXUnix |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
92 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
93 call assert_equal("unix\nunix\n", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
94 e! XXDos |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
95 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
96 call assert_equal("dos\r\ndos\r\n", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
97 e! XXMac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
98 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
99 call assert_equal("mac\rmac\r\n", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
100 bwipe XXUnix XXDos XXMac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
101 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
102 " try with 'fileformat' set to 'dos' |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
103 set fileformat=dos |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
104 e! XXUnix |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
105 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
106 call assert_equal("unix\r\nunix\r\n", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
107 e! XXDos |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
108 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
109 call assert_equal("dos\r\ndos\r\n", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
110 e! XXMac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
111 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
112 call assert_equal("mac\rmac\r\r\n", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
113 bwipe XXUnix XXDos XXMac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
114 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
115 " try with 'fileformat' set to 'mac' |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
116 set fileformat=mac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
117 e! XXUnix |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
118 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
119 call assert_equal("unix\nunix\n\r", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
120 e! XXDos |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
121 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
122 call assert_equal("dos\r\ndos\r\n\r", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
123 e! XXMac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
124 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
125 call assert_equal("mac\rmac\r", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
126 bwipe XXUnix XXDos XXMac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
127 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
128 " Test 2: try reading and writing with 'fileformats' set to one format |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
129 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
130 " try with 'fileformats' set to 'unix' |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
131 set fileformats=unix |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
132 e! XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
133 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
134 call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r\n", |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
135 \ s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
136 bwipe XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
137 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
138 " try with 'fileformats' set to 'dos' |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
139 set fileformats=dos |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
140 e! XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
141 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
142 call assert_equal("unix\r\nunix\r\ndos\r\ndos\r\nmac\rmac\r\r\n", |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
143 \ s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
144 bwipe XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
145 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
146 " try with 'fileformats' set to 'mac' |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
147 set fileformats=mac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
148 e! XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
149 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
150 call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r", |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
151 \ s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
152 bwipe XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
153 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
154 " Test 3: try reading and writing with 'fileformats' set to two formats |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
155 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
156 " try with 'fileformats' set to 'unix,dos' |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
157 set fileformats=unix,dos |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
158 e! XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
159 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
160 call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r\n", |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
161 \ s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
162 bwipe XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
163 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
164 e! XXUxMac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
165 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
166 call assert_equal("unix\nunix\nmac\rmac\r\n", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
167 bwipe XXUxMac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
168 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
169 e! XXDosMac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
170 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
171 call assert_equal("dos\r\ndos\r\nmac\rmac\r\r\n", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
172 bwipe XXDosMac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
173 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
174 " try with 'fileformats' set to 'unix,mac' |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
175 set fileformats=unix,mac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
176 e! XXUxDs |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
177 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
178 call assert_equal("unix\nunix\ndos\r\ndos\r\n", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
179 bwipe XXUxDs |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
180 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
181 e! XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
182 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
183 call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r\n", |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
184 \ s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
185 bwipe XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
186 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
187 e! XXDosMac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
188 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
189 call assert_equal("dos\r\ndos\r\nmac\rmac\r", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
190 bwipe XXDosMac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
191 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
192 e! XXEol |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
193 exe "normal ggO\<C-R>=&ffs\<CR>:\<C-R>=&ff\<CR>" |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
194 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
195 call assert_equal("unix,mac:unix\nnoeol\n", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
196 bwipe! XXEol |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
197 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
198 " try with 'fileformats' set to 'dos,mac' |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
199 set fileformats=dos,mac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
200 e! XXUxDs |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
201 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
202 call assert_equal("unix\r\nunix\r\ndos\r\ndos\r\n", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
203 bwipe XXUxDs |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
204 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
205 e! XXUxMac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
206 exe "normal ggO\<C-R>=&ffs\<CR>:\<C-R>=&ff\<CR>" |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
207 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
208 call assert_equal("dos,mac:dos\r\nunix\r\nunix\r\nmac\rmac\r\r\n", |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
209 \ s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
210 bwipe! XXUxMac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
211 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
212 e! XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
213 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
214 call assert_equal("unix\r\nunix\r\ndos\r\ndos\r\nmac\rmac\r\r\n", |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
215 \ s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
216 bwipe XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
217 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
218 e! XXMacEol |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
219 exe "normal ggO\<C-R>=&ffs\<CR>:\<C-R>=&ff\<CR>" |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
220 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
221 call assert_equal("dos,mac:mac\rmac\rmac\rnoeol\r", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
222 bwipe! XXMacEol |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
223 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
224 " Test 4: try reading and writing with 'fileformats' set to three formats |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
225 set fileformats=unix,dos,mac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
226 e! XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
227 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
228 call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r\n", |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
229 \ s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
230 bwipe XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
231 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
232 e! XXEol |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
233 exe "normal ggO\<C-R>=&ffs\<CR>:\<C-R>=&ff\<CR>" |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
234 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
235 call assert_equal("unix,dos,mac:unix\nnoeol\n", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
236 bwipe! XXEol |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
237 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
238 set fileformats=mac,dos,unix |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
239 e! XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
240 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
241 call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r\n", |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
242 \ s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
243 bwipe XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
244 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
245 e! XXEol |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
246 exe "normal ggO\<C-R>=&ffs\<CR>:\<C-R>=&ff\<CR>" |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
247 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
248 call assert_equal("mac,dos,unix:mac\rnoeol\r", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
249 bwipe! XXEol |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
250 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
251 " Test 5: try with 'binary' set |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
252 set fileformats=mac,unix,dos |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
253 set binary |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
254 e! XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
255 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
256 call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r", |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
257 \ s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
258 bwipe XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
259 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
260 set fileformats=mac |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
261 e! XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
262 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
263 call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r", |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
264 \ s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
265 bwipe XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
266 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
267 set fileformats=dos |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
268 e! XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
269 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
270 call assert_equal("unix\nunix\ndos\r\ndos\r\nmac\rmac\r", |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
271 \ s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
272 bwipe XXUxDsMc |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
273 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
274 e! XXUnix |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
275 w! Xtest |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
276 call assert_equal("unix\nunix\n", s:file2str('Xtest')) |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
277 bwipe! XXUnix |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
278 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
279 set nobinary ff& ffs& |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
280 |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
281 " cleanup |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
282 only |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
283 %bwipe! |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
284 call delete('XXUxDs') |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
285 call delete('XXUxMac') |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
286 call delete('XXDosMac') |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
287 call delete('XXMacEol') |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
288 call delete('XXUxDsMc') |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
289 call delete('Xtest') |
140bf183f946
patch 8.1.1412: test 30 is old style
Bram Moolenaar <Bram@vim.org>
parents:
10674
diff
changeset
|
290 endfunc |
19407
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
291 |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
292 " Test for changing the fileformat using ++read |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
293 func Test_fileformat_plusplus_read() |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
294 new |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
295 call setline(1, ['one', 'two', 'three']) |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
296 w ++ff=dos Xfile1 |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
297 enew! |
19413
85e8bee2e3e2
patch 8.2.0264: fileformat test still fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
19409
diff
changeset
|
298 set ff=unix |
19409
ba6afd154f91
patch 8.2.0262: fileformat test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
19407
diff
changeset
|
299 " A :read doesn't change the fileformat, but does apply to the read lines. |
19407
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
300 r ++fileformat=unix Xfile1 |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
301 call assert_equal('unix', &fileformat) |
19409
ba6afd154f91
patch 8.2.0262: fileformat test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents:
19407
diff
changeset
|
302 call assert_equal("three\r", getline('$')) |
19407
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
303 3r ++edit Xfile1 |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
304 call assert_equal('dos', &fileformat) |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
305 close! |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
306 call delete('Xfile1') |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
307 set fileformat& |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
308 call assert_fails('e ++fileformat Xfile1', 'E474:') |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
309 call assert_fails('e ++ff=abc Xfile1', 'E474:') |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
310 call assert_fails('e ++abc1 Xfile1', 'E474:') |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
311 endfunc |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
312 |
24946
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
313 " When Vim starts up with an empty buffer the first item in 'fileformats' is |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
314 " used as the 'fileformat'. |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
315 func Test_fileformat_on_startup() |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
316 let after =<< trim END |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
24946
diff
changeset
|
317 call writefile([&fileformat], 'Xonsfile', 'a') |
24946
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
318 quit |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
319 END |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
320 call RunVim(["set ffs=dos,unix,mac"], after, '') |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
321 call RunVim(["set ffs=mac,dos,unix"], after, '') |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
322 call RunVim(["set ffs=unix,mac,dos"], after, '') |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
24946
diff
changeset
|
323 call assert_equal(['dos', 'mac', 'unix'], readfile('Xonsfile')) |
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
24946
diff
changeset
|
324 call delete('Xonsfile') |
24946
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
325 endfunc |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
326 |
19407
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
16821
diff
changeset
|
327 " vim: shiftwidth=2 sts=2 expandtab |