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
|
|
35 :w! XXtt
|
|
36 :!cat XXtt >>test.out
|
|
37 :e! XXMac
|
|
38 :w! XXtt
|
|
39 :!cat XXtt >>test.out
|
|
40 :!cat XX1 >>test.out
|
|
41 :bwipe XXUnix XXDos XXMac
|
|
42 :set fileformat=dos
|
|
43 :e! XXUnix
|
|
44 :w! XXtt
|
|
45 :!cat XXtt >>test.out
|
|
46 :e! XXDos
|
|
47 :w! XXtt
|
|
48 :!cat XXtt >>test.out
|
|
49 :e! XXMac
|
|
50 :w! XXtt
|
|
51 :!cat XXtt >>test.out
|
|
52 :!cat XX2 >>test.out
|
|
53 :bwipe XXUnix XXDos XXMac
|
|
54 :set fileformat=mac
|
|
55 :e! XXUnix
|
|
56 :w! XXtt
|
|
57 :!cat XXtt >>test.out
|
|
58 :e! XXDos
|
|
59 :w! XXtt
|
|
60 :!cat XXtt >>test.out
|
|
61 :e! XXMac
|
|
62 :w! XXtt
|
|
63 :!cat XXtt >>test.out
|
|
64 :!cat XX3 >>test.out
|
|
65 :bwipe XXUnix XXDos XXMac
|
|
66 :"
|
|
67 :" try reading and writing with 'fileformats' set to one format
|
|
68 :set fileformats=unix
|
|
69 :e! XXUxDsMc
|
|
70 :w! XXtt
|
|
71 :!cat XXtt >>test.out
|
|
72 :bwipe XXUxDsMc
|
|
73 :set fileformats=dos
|
|
74 :e! XXUxDsMc
|
|
75 :w! XXtt
|
|
76 :!cat XXtt >>test.out
|
|
77 :bwipe XXUxDsMc
|
|
78 :set fileformats=mac
|
|
79 :e! XXUxDsMc
|
|
80 :w! XXtt
|
|
81 :!cat XXtt >>test.out
|
|
82 :bwipe XXUxDsMc
|
|
83 :!cat XX4 >>test.out
|
|
84 :"
|
|
85 :" try reading and writing with 'fileformats' set to two formats
|
|
86 :set fileformats=unix,dos
|
|
87 :e! XXUxDsMc
|
|
88 :w! XXtt
|
|
89 :!cat XXtt >>test.out
|
|
90 :bwipe XXUxDsMc
|
|
91 :e! XXUxMac
|
|
92 :w! XXtt
|
|
93 :!cat XXtt >>test.out
|
|
94 :bwipe XXUxMac
|
|
95 :e! XXDosMac
|
|
96 :w! XXtt
|
|
97 :!cat XXtt >>test.out
|
|
98 :bwipe XXDosMac
|
|
99 :!cat XX5 >>test.out
|
|
100 :set fileformats=unix,mac
|
|
101 :e! XXUxDs
|
|
102 :w! XXtt
|
|
103 :!cat XXtt >>test.out
|
|
104 :bwipe XXUxDs
|
|
105 :e! XXUxDsMc
|
|
106 :w! XXtt
|
|
107 :!cat XXtt >>test.out
|
|
108 :bwipe XXUxDsMc
|
|
109 :e! XXDosMac
|
|
110 :w! XXtt
|
|
111 :!cat XXtt >>test.out
|
|
112 :bwipe XXDosMac
|
|
113 :!cat XX6 >>test.out
|
|
114 :set fileformats=dos,mac
|
|
115 :e! XXUxDs
|
|
116 :w! XXtt
|
|
117 :!cat XXtt >>test.out
|
|
118 :bwipe XXUxDs
|
|
119 :e! XXUxMac
|
|
120 :w! XXtt
|
|
121 :!cat XXtt >>test.out
|
|
122 :bwipe XXUxMac
|
|
123 :e! XXUxDsMc
|
|
124 :w! XXtt
|
|
125 :!cat XXtt >>test.out
|
|
126 :bwipe XXUxDsMc
|
|
127 :!cat XX7 >>test.out
|
|
128 :"
|
|
129 :" try reading and writing with 'fileformats' set to three formats
|
|
130 :set fileformats=unix,dos,mac
|
|
131 :e! XXUxDsMc
|
|
132 :w! XXtt
|
|
133 :!cat XXtt >>test.out
|
|
134 :bwipe XXUxDsMc
|
|
135 :!cat XX8 >>test.out
|
|
136 :set fileformats=mac,dos,unix
|
|
137 :e! XXUxDsMc
|
|
138 :w! XXtt
|
|
139 :!cat XXtt >>test.out
|
|
140 :bwipe XXUxDsMc
|
|
141 :!cat XX9 >>test.out
|
|
142 :" try with 'binary' set
|
|
143 :set fileformats=mac,unix,dos
|
|
144 :set binary
|
|
145 :e! XXUxDsMc
|
|
146 :w! XXtt
|
|
147 :!cat XXtt >>test.out
|
|
148 :bwipe XXUxDsMc
|
|
149 :set fileformats=mac
|
|
150 :e! XXUxDsMc
|
|
151 :w! XXtt
|
|
152 :!cat XXtt >>test.out
|
|
153 :bwipe XXUxDsMc
|
|
154 :set fileformats=dos
|
|
155 :e! XXUxDsMc
|
|
156 :w! XXtt
|
|
157 :!cat XXtt >>test.out
|
|
158 :!cat XX10 >>test.out
|
|
159 :" add a newline at the end
|
|
160 :!cat XXUnix >>test.out
|
|
161 :qa!
|
|
162 ENDTEST
|
|
163
|
|
164 1
|
|
165 2
|
|
166 3
|
|
167 4
|
|
168 5
|
|
169 6
|
|
170 7
|
|
171 8
|
|
172 9
|
|
173 10
|
|
174
|
|
175 unix
|
|
176 unix
|
|
177 eof
|
|
178
|
|
179 dos
|
|
180 dos
|
|
181 eof
|
|
182
|
|
183 mac
mac
|