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