7
|
1 Test for a lot of variations of the 'fileformats' option
|
|
2
|
1668
|
3 Note: This test will fail if "cat" is not available.
|
|
4
|
7
|
5 STARTTEST
|
|
6 :so small.vim
|
|
7 :" first write three test files, one in each format
|
|
8 :set fileformat=unix
|
|
9 :set fileformats=
|
|
10 :/^1/w! XX1
|
|
11 :/^2/w! XX2
|
|
12 :/^3/w! XX3
|
|
13 :/^4/w! XX4
|
|
14 :/^5/w! XX5
|
|
15 :/^6/w! XX6
|
|
16 :/^7/w! XX7
|
|
17 :/^8/w! XX8
|
|
18 :/^9/w! XX9
|
|
19 :/^10/w! XX10
|
|
20 :/^unix/;/eof/-1w! XXUnix
|
|
21 :/^dos/;/eof/-1w! XXDos
|
|
22 :set bin noeol
|
|
23 :$w! XXMac
|
|
24 :set nobin eol
|
|
25 :bwipe XXUnix XXDos XXMac
|
|
26 :" create mixed format files
|
|
27 :!cat XXUnix XXDos >XXUxDs
|
|
28 :!cat XXUnix XXMac >XXUxMac
|
|
29 :!cat XXDos XXMac >XXDosMac
|
|
30 :!cat XXUnix XXDos XXMac >XXUxDsMc
|
|
31 :"
|
|
32 :" try reading and writing with 'fileformats' empty
|
|
33 :set fileformat=unix
|
|
34 :e! XXUnix
|
|
35 :w! test.out
|
|
36 :e! XXDos
|
57
|
37 :w! XXtt01
|
7
|
38 :e! XXMac
|
57
|
39 :w! XXtt02
|
7
|
40 :bwipe XXUnix XXDos XXMac
|
|
41 :set fileformat=dos
|
|
42 :e! XXUnix
|
57
|
43 :w! XXtt11
|
7
|
44 :e! XXDos
|
57
|
45 :w! XXtt12
|
7
|
46 :e! XXMac
|
57
|
47 :w! XXtt13
|
7
|
48 :bwipe XXUnix XXDos XXMac
|
|
49 :set fileformat=mac
|
|
50 :e! XXUnix
|
57
|
51 :w! XXtt21
|
7
|
52 :e! XXDos
|
57
|
53 :w! XXtt22
|
7
|
54 :e! XXMac
|
57
|
55 :w! XXtt23
|
7
|
56 :bwipe XXUnix XXDos XXMac
|
|
57 :"
|
|
58 :" try reading and writing with 'fileformats' set to one format
|
|
59 :set fileformats=unix
|
|
60 :e! XXUxDsMc
|
57
|
61 :w! XXtt31
|
7
|
62 :bwipe XXUxDsMc
|
|
63 :set fileformats=dos
|
|
64 :e! XXUxDsMc
|
57
|
65 :w! XXtt32
|
7
|
66 :bwipe XXUxDsMc
|
|
67 :set fileformats=mac
|
|
68 :e! XXUxDsMc
|
57
|
69 :w! XXtt33
|
7
|
70 :bwipe XXUxDsMc
|
|
71 :"
|
|
72 :" try reading and writing with 'fileformats' set to two formats
|
|
73 :set fileformats=unix,dos
|
|
74 :e! XXUxDsMc
|
57
|
75 :w! XXtt41
|
7
|
76 :bwipe XXUxDsMc
|
|
77 :e! XXUxMac
|
57
|
78 :w! XXtt42
|
7
|
79 :bwipe XXUxMac
|
|
80 :e! XXDosMac
|
57
|
81 :w! XXtt43
|
7
|
82 :bwipe XXDosMac
|
|
83 :set fileformats=unix,mac
|
|
84 :e! XXUxDs
|
57
|
85 :w! XXtt51
|
7
|
86 :bwipe XXUxDs
|
|
87 :e! XXUxDsMc
|
57
|
88 :w! XXtt52
|
7
|
89 :bwipe XXUxDsMc
|
|
90 :e! XXDosMac
|
57
|
91 :w! XXtt53
|
7
|
92 :bwipe XXDosMac
|
|
93 :set fileformats=dos,mac
|
|
94 :e! XXUxDs
|
57
|
95 :w! XXtt61
|
7
|
96 :bwipe XXUxDs
|
|
97 :e! XXUxMac
|
57
|
98 :w! XXtt62
|
7
|
99 :bwipe XXUxMac
|
|
100 :e! XXUxDsMc
|
57
|
101 :w! XXtt63
|
7
|
102 :bwipe XXUxDsMc
|
|
103 :"
|
|
104 :" try reading and writing with 'fileformats' set to three formats
|
|
105 :set fileformats=unix,dos,mac
|
|
106 :e! XXUxDsMc
|
57
|
107 :w! XXtt71
|
7
|
108 :bwipe XXUxDsMc
|
|
109 :set fileformats=mac,dos,unix
|
|
110 :e! XXUxDsMc
|
57
|
111 :w! XXtt81
|
7
|
112 :bwipe XXUxDsMc
|
|
113 :" try with 'binary' set
|
|
114 :set fileformats=mac,unix,dos
|
|
115 :set binary
|
|
116 :e! XXUxDsMc
|
57
|
117 :w! XXtt91
|
7
|
118 :bwipe XXUxDsMc
|
|
119 :set fileformats=mac
|
|
120 :e! XXUxDsMc
|
57
|
121 :w! XXtt92
|
7
|
122 :bwipe XXUxDsMc
|
|
123 :set fileformats=dos
|
|
124 :e! XXUxDsMc
|
57
|
125 :w! XXtt93
|
|
126 :"
|
|
127 :" Append "END" to each file so that we can see what the last written char was.
|
|
128 :set fileformat=unix nobin
|
|
129 ggdGaEND:w >>XXtt01
|
|
130 :w >>XXtt02
|
|
131 :w >>XXtt11
|
|
132 :w >>XXtt12
|
|
133 :w >>XXtt13
|
|
134 :w >>XXtt21
|
|
135 :w >>XXtt22
|
|
136 :w >>XXtt23
|
|
137 :w >>XXtt31
|
|
138 :w >>XXtt32
|
|
139 :w >>XXtt33
|
|
140 :w >>XXtt41
|
|
141 :w >>XXtt42
|
|
142 :w >>XXtt43
|
|
143 :w >>XXtt51
|
|
144 :w >>XXtt52
|
|
145 :w >>XXtt53
|
|
146 :w >>XXtt61
|
|
147 :w >>XXtt62
|
|
148 :w >>XXtt63
|
|
149 :w >>XXtt71
|
|
150 :w >>XXtt81
|
|
151 :w >>XXtt91
|
|
152 :w >>XXtt92
|
|
153 :w >>XXtt93
|
|
154 :"
|
|
155 :" Concatenate the results.
|
|
156 :" Make fileformat of test.out the native fileformat.
|
|
157 :" Add a newline at the end.
|
|
158 :set binary
|
|
159 :e! test.out
|
|
160 :$r XXtt01
|
|
161 :$r XXtt02
|
|
162 Go1:$r XXtt11
|
|
163 :$r XXtt12
|
|
164 :$r XXtt13
|
|
165 Go2:$r XXtt21
|
|
166 :$r XXtt22
|
|
167 :$r XXtt23
|
|
168 Go3:$r XXtt31
|
|
169 :$r XXtt32
|
|
170 :$r XXtt33
|
|
171 Go4:$r XXtt41
|
|
172 :$r XXtt42
|
|
173 :$r XXtt43
|
|
174 Go5:$r XXtt51
|
|
175 :$r XXtt52
|
|
176 :$r XXtt53
|
|
177 Go6:$r XXtt61
|
|
178 :$r XXtt62
|
|
179 :$r XXtt63
|
|
180 Go7:$r XXtt71
|
|
181 Go8:$r XXtt81
|
|
182 Go9:$r XXtt91
|
|
183 :$r XXtt92
|
|
184 :$r XXtt93
|
|
185 Go10:$r XXUnix
|
|
186 :set nobinary ff&
|
|
187 :w
|
7
|
188 :qa!
|
|
189 ENDTEST
|
|
190
|
|
191 1
|
|
192 2
|
|
193 3
|
|
194 4
|
|
195 5
|
|
196 6
|
|
197 7
|
|
198 8
|
|
199 9
|
|
200 10
|
|
201
|
|
202 unix
|
|
203 unix
|
|
204 eof
|
|
205
|
|
206 dos
|
|
207 dos
|
|
208 eof
|
|
209
|
|
210 mac
mac
|