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