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