Merged from the latest developing branch.
[MacVim.git] / src / testdir / test30.in
blobc2ee2f06df4bb7d14518ec8a035713b9481afca5
1 Test for a lot of variations of the 'fileformats' option
3 Note: This test will fail if "cat" is not available.
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 :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
39 :" try reading and writing with 'fileformats' empty
40 :set fileformat=unix
41 :e! XXUnix
42 :w! test.out
43 :e! XXDos
44 :w! XXtt01
45 :e! XXMac
46 :w! XXtt02
47 :bwipe XXUnix XXDos XXMac
48 :set fileformat=dos
49 :e! XXUnix
50 :w! XXtt11
51 :e! XXDos
52 :w! XXtt12
53 :e! XXMac
54 :w! XXtt13
55 :bwipe XXUnix XXDos XXMac
56 :set fileformat=mac
57 :e! XXUnix
58 :w! XXtt21
59 :e! XXDos
60 :w! XXtt22
61 :e! XXMac
62 :w! XXtt23
63 :bwipe XXUnix XXDos XXMac
65 :" try reading and writing with 'fileformats' set to one format
66 :set fileformats=unix
67 :e! XXUxDsMc
68 :w! XXtt31
69 :bwipe XXUxDsMc
70 :set fileformats=dos
71 :e! XXUxDsMc
72 :w! XXtt32
73 :bwipe XXUxDsMc
74 :set fileformats=mac
75 :e! XXUxDsMc
76 :w! XXtt33
77 :bwipe XXUxDsMc
79 :" try reading and writing with 'fileformats' set to two formats
80 :set fileformats=unix,dos
81 :e! XXUxDsMc
82 :w! XXtt41
83 :bwipe XXUxDsMc
84 :e! XXUxMac
85 :w! XXtt42
86 :bwipe XXUxMac
87 :e! XXDosMac
88 :w! XXtt43
89 :bwipe XXDosMac
90 :set fileformats=unix,mac
91 :e! XXUxDs
92 :w! XXtt51
93 :bwipe XXUxDs
94 :e! XXUxDsMc
95 :w! XXtt52
96 :bwipe XXUxDsMc
97 :e! XXDosMac
98 :w! XXtt53
99 :bwipe XXDosMac
100 :set fileformats=dos,mac
101 :e! XXUxDs
102 :w! XXtt61
103 :bwipe XXUxDs
104 :e! XXUxMac
105 :w! XXtt62
106 :bwipe XXUxMac
107 :e! XXUxDsMc
108 :w! XXtt63
109 :bwipe XXUxDsMc
111 :" try reading and writing with 'fileformats' set to three formats
112 :set fileformats=unix,dos,mac
113 :e! XXUxDsMc
114 :w! XXtt71
115 :bwipe XXUxDsMc
116 :set fileformats=mac,dos,unix
117 :e! XXUxDsMc
118 :w! XXtt81
119 :bwipe XXUxDsMc
120 :" try with 'binary' set
121 :set fileformats=mac,unix,dos
122 :set binary
123 :e! XXUxDsMc
124 :w! XXtt91
125 :bwipe XXUxDsMc
126 :set fileformats=mac
127 :e! XXUxDsMc
128 :w! XXtt92
129 :bwipe XXUxDsMc
130 :set fileformats=dos
131 :e! XXUxDsMc
132 :w! XXtt93
134 :" Append "END" to each file so that we can see what the last written char was.
135 :set fileformat=unix nobin
136 ggdGaEND\e: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
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\e:$r XXtt11
170 :$r XXtt12
171 :$r XXtt13
172 Go2\e:$r XXtt21
173 :$r XXtt22
174 :$r XXtt23
175 Go3\e:$r XXtt31
176 :$r XXtt32
177 :$r XXtt33
178 Go4\e:$r XXtt41
179 :$r XXtt42
180 :$r XXtt43
181 Go5\e:$r XXtt51
182 :$r XXtt52
183 :$r XXtt53
184 Go6\e:$r XXtt61
185 :$r XXtt62
186 :$r XXtt63
187 Go7\e:$r XXtt71
188 Go8\e:$r XXtt81
189 Go9\e:$r XXtt91
190 :$r XXtt92
191 :$r XXtt93
192 Go10\e:$r XXUnix
193 :set nobinary ff&
195 :qa!
196 ENDTEST
209 unix
210 unix
213 dos\r
214 dos\r
217 mac\rmac\r