author | Claus Gittinger <cg@exept.de> |
Thu, 17 May 2018 23:31:05 +0200 | |
changeset 1939 | 9a6e4956515f |
parent 1611 | 7cc93d8bb66f |
child 2173 | d4d16e3f15f0 |
permissions | -rw-r--r-- |
1447 | 1 |
"{ Package: 'stx:goodies/regression' }" |
69 | 2 |
|
0 | 3 |
"{ NameSpace: RegressionTests }" |
4 |
||
118 | 5 |
TestCase subclass:#FileStreamTest |
0 | 6 |
instanceVariableNames:'' |
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
1079 | 9 |
category:'tests-Regression-Streams' |
0 | 10 |
! |
11 |
||
12 |
||
697 | 13 |
!FileStreamTest methodsFor:'cleanup'! |
14 |
||
15 |
tearDown |
|
1447 | 16 |
self testFilename remove |
697 | 17 |
! ! |
18 |
||
120 | 19 |
!FileStreamTest methodsFor:'helpers'! |
0 | 20 |
|
332
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
21 |
createBigDirectoryWithManyFiles |
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
22 |
"create a directory with 20000 files" |
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
23 |
|
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
24 |
'c:\tmp' asFilename exists ifFalse:[ |
1447 | 25 |
'c:\tmp' asFilename makeDirectory |
332
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
26 |
]. |
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
27 |
'c:\tmp\BigDirectory' asFilename exists ifFalse:[ |
1447 | 28 |
'c:\tmp\BigDirectory' asFilename makeDirectory |
332
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
29 |
]. |
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
30 |
|
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
31 |
1 to:20000 do:[:i| |
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
32 |
|f s buffer| |
1447 | 33 |
f :='c:\tmp\BigDirectory' asFilename |
34 |
construct:(i printString leftPaddedTo:5 with:$0). |
|
332
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
35 |
s := f writeStream binary. |
1447 | 36 |
buffer := ByteArray new:1024. |
332
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
37 |
32 timesRepeat:[ s nextPutAll:buffer ]. |
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
38 |
s close. |
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
39 |
]. |
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
40 |
|
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
41 |
" |
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
42 |
self new createBigDirectoryWithManyFiles |
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
43 |
" |
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
44 |
|
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
45 |
"Created: / 12.8.1998 / 13:25:25 / cg" |
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
46 |
! |
917e3efbdbaa
changed #createBigDirectoryWithManyFiles
Claus Gittinger <cg@exept.de>
parents:
181
diff
changeset
|
47 |
|
0 | 48 |
createTestFile |
49 |
"create a test file (100k size)" |
|
50 |
||
51 |
|f bytes| |
|
52 |
||
893
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
53 |
f := self testFilename writeStream binary. |
0 | 54 |
bytes := ByteArray new:1024. |
55 |
1 to:bytes size do:[:i | |
|
1447 | 56 |
bytes at:i put:(i \\ 256). |
0 | 57 |
]. |
58 |
||
59 |
100 timesRepeat:[ |
|
1447 | 60 |
f nextPutAll:bytes. |
0 | 61 |
]. |
62 |
||
63 |
f close. |
|
64 |
||
65 |
" |
|
119 | 66 |
self new createTestFile |
0 | 67 |
" |
68 |
||
69 |
"Created: / 12.8.1998 / 13:25:25 / cg" |
|
70 |
! |
|
71 |
||
120 | 72 |
doTestWrite:size |
1610 | 73 |
"Basic writing. Writes a chunk of data and reads it back to verify that |
74 |
it was written correctly. |
|
75 |
Called with different sizes and interrupted while writing." |
|
120 | 76 |
|
77 |
|file s sz buffer byte| |
|
78 |
||
79 |
buffer := ByteArray new:size. |
|
80 |
1 to:buffer size do:[:idx | |
|
1610 | 81 |
buffer at:idx put:(idx \\ 256) |
120 | 82 |
]. |
83 |
||
84 |
file := Filename newTemporary. |
|
85 |
s := file writeStream. |
|
86 |
||
87 |
s binary. |
|
88 |
s nextPutAll:buffer. |
|
89 |
s close. |
|
90 |
||
91 |
sz := file fileSize. |
|
92 |
sz ~= size ifTrue:[self error:'size mismatch']. |
|
93 |
||
94 |
s := file readStream. |
|
95 |
s binary. |
|
96 |
1 to:size do:[:idx | |
|
1610 | 97 |
byte := s next. |
98 |
byte ~~ (idx \\ 256) ifTrue:[self error:'read data mismatch']. |
|
120 | 99 |
]. |
100 |
s close. |
|
101 |
||
102 |
(file binaryContentsOfEntireFile ~= buffer) ifTrue:[ |
|
1610 | 103 |
self error:'read data mismatch2' |
120 | 104 |
]. |
105 |
file delete. |
|
106 |
||
107 |
" |
|
108 |
self testWrite:1024 |
|
109 |
" |
|
1610 | 110 |
|
111 |
"Modified (comment): / 14-06-2017 / 15:53:07 / mawalch" |
|
120 | 112 |
! |
113 |
||
0 | 114 |
readFileExpecting:expect |
115 |
"read test file, expect n bytes" |
|
116 |
||
117 |
|f buffer n nRead| |
|
118 |
||
893
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
119 |
f := self testFilename readStream binary. |
0 | 120 |
buffer := ByteArray new:128. |
121 |
||
122 |
n := 0. |
|
123 |
[f atEnd] whileFalse:[ |
|
1447 | 124 |
nRead := f nextBytes:128 into:buffer. |
125 |
n := n + nRead. |
|
0 | 126 |
]. |
127 |
f close. |
|
893
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
128 |
self assert:(expect = n) description:('got <1p>; expected:<2p>' expandMacrosWith:n with:expect) |
0 | 129 |
|
130 |
"Created: / 12.8.1998 / 13:29:41 / cg" |
|
131 |
"Modified: / 12.8.1998 / 13:36:40 / cg" |
|
893
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
132 |
! |
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
133 |
|
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
134 |
testFilename |
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
135 |
^ 'testFile' asFilename |
120 | 136 |
! ! |
137 |
||
138 |
!FileStreamTest methodsFor:'tests'! |
|
0 | 139 |
|
75 | 140 |
testAppend1 |
141 |
"basic open for appending." |
|
142 |
||
119 | 143 |
|file s sz actualContents expectedContents| |
75 | 144 |
|
145 |
file := Filename newTemporary. |
|
146 |
s := file writeStream. |
|
147 |
s binary. |
|
148 |
s nextPutAll:(1 to:100). |
|
149 |
s close. |
|
150 |
||
151 |
sz := file fileSize. |
|
119 | 152 |
self should:[ sz = 100 ]. "/ size mismatch |
75 | 153 |
|
154 |
s := file appendingWriteStream. |
|
155 |
s binary. |
|
156 |
s nextPutAll:(101 to:200). |
|
157 |
s close. |
|
158 |
||
159 |
sz := file fileSize. |
|
119 | 160 |
self should:[ sz = 200 ]. "/ size mismatch |
75 | 161 |
|
119 | 162 |
actualContents := file binaryContentsOfEntireFile. |
163 |
expectedContents := (1 to:200) asByteArray. |
|
164 |
self should:[ (actualContents = expectedContents) ]. "/ contents mismatch |
|
75 | 165 |
|
166 |
file delete. |
|
167 |
||
168 |
" |
|
119 | 169 |
self new testAppend1 |
75 | 170 |
" |
171 |
! |
|
172 |
||
173 |
testOpenRead1 |
|
174 |
"basic open for reading." |
|
175 |
||
176 |
|sz| |
|
177 |
||
178 |
self createTestFile. |
|
179 |
||
893
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
180 |
sz := self testFilename fileSize. |
75 | 181 |
|
182 |
self readFileExpecting:sz. |
|
183 |
||
184 |
" |
|
119 | 185 |
self new testOpenRead1 |
75 | 186 |
" |
187 |
! |
|
188 |
||
189 |
testRead1 |
|
0 | 190 |
"read a file - check count read with files size." |
191 |
||
192 |
|sz| |
|
193 |
||
194 |
self createTestFile. |
|
195 |
||
893
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
196 |
sz := self testFilename fileSize. |
0 | 197 |
|
198 |
self readFileExpecting:sz. |
|
199 |
||
200 |
" |
|
119 | 201 |
self new testRead1 |
0 | 202 |
" |
203 |
||
204 |
"Modified: / 12.8.1998 / 13:29:55 / cg" |
|
205 |
! |
|
206 |
||
75 | 207 |
testRead2 |
0 | 208 |
"read a file - check count read with files size. |
209 |
Do this in 20 threads" |
|
210 |
||
893
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
211 |
|sz verbose errorOccured sema| |
651 | 212 |
|
213 |
verbose := false. |
|
0 | 214 |
|
215 |
self createTestFile. |
|
893
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
216 |
self assert:(self testFilename exists). |
0 | 217 |
|
893
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
218 |
sz := self testFilename fileSize. |
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
219 |
sema := Semaphore new:1-20. |
0 | 220 |
20 timesRepeat:[ |
1447 | 221 |
[ |
222 |
[ |
|
223 |
self readFileExpecting:sz. |
|
224 |
verbose ifTrue:[ 'done' printCR ]. |
|
225 |
] on:Error do:[:ex| |
|
226 |
errorOccured := ex. |
|
227 |
]. |
|
228 |
sema signal. |
|
229 |
] fork. |
|
0 | 230 |
]. |
893
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
231 |
self assert:(sema waitWithTimeout:20) notNil. |
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
232 |
self assert:errorOccured isNil. |
0 | 233 |
|
234 |
" |
|
119 | 235 |
self new testRead2 |
0 | 236 |
" |
237 |
||
651 | 238 |
"Modified: / 10-01-2012 / 19:28:45 / cg" |
0 | 239 |
! |
240 |
||
75 | 241 |
testRead3 |
0 | 242 |
"read a file - check count read with files size. |
243 |
Do this and interrupt the reading thread heavily" |
|
244 |
||
893
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
245 |
|sz p count nLoop errorOccured| |
0 | 246 |
|
247 |
nLoop := 1000. |
|
248 |
||
249 |
self createTestFile. |
|
250 |
||
893
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
251 |
sz := self testFilename fileSize. |
0 | 252 |
|
253 |
p := [ |
|
1447 | 254 |
[ |
255 |
nLoop timesRepeat:[ |
|
256 |
self readFileExpecting:sz. |
|
257 |
]. |
|
258 |
] on:Error do:[:ex| |
|
259 |
errorOccured := ex. |
|
260 |
]. |
|
30 | 261 |
] forkAt:7. |
262 |
||
263 |
count := 0. |
|
264 |
[p isDead] whileFalse:[ |
|
1447 | 265 |
Delay waitForMilliseconds:5. |
266 |
p interruptWith:[count := count + 1]. |
|
30 | 267 |
]. |
893
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
268 |
self assert:errorOccured isNil. |
1364 | 269 |
self assert:count > 50. "/ at least 50 times interrupted... |
270 |
"/ Transcript printf:'read file %d times; interrupted %d times\n' with:nLoop with:count. |
|
30 | 271 |
|
272 |
" |
|
119 | 273 |
self new testRead3 |
30 | 274 |
" |
275 |
||
276 |
"Modified: / 12.8.1998 / 13:42:13 / cg" |
|
277 |
! |
|
278 |
||
75 | 279 |
testRewrite1 |
280 |
"basic open for writing (with truncation)." |
|
281 |
||
282 |
|file s sz| |
|
283 |
||
284 |
file := Filename newTemporary. |
|
285 |
s := file writeStream. |
|
286 |
s binary. |
|
287 |
s nextPutAll:(1 to:200). |
|
288 |
s close. |
|
289 |
||
290 |
sz := file fileSize. |
|
291 |
sz ~= 200 ifTrue:[self error:'size mismatch']. |
|
292 |
||
293 |
s := file writeStream. |
|
294 |
s binary. |
|
295 |
s nextPutAll:(101 to:200). |
|
296 |
s close. |
|
297 |
||
298 |
sz := file fileSize. |
|
299 |
sz ~= 100 ifTrue:[self error:'size mismatch']. |
|
300 |
||
301 |
(file binaryContentsOfEntireFile ~= (101 to:200) asByteArray) ifTrue:[ |
|
1447 | 302 |
self error:'contents mismatch' |
75 | 303 |
]. |
304 |
||
305 |
file delete. |
|
306 |
||
307 |
" |
|
120 | 308 |
self new testRewrite1 |
75 | 309 |
" |
310 |
! |
|
311 |
||
312 |
testRewrite2 |
|
313 |
"basic open for re-writing (without truncation)." |
|
314 |
||
315 |
|file s sz| |
|
316 |
||
317 |
file := Filename newTemporary. |
|
318 |
s := file writeStream. |
|
319 |
s binary. |
|
320 |
s nextPutAll:(1 to:200). |
|
321 |
s close. |
|
322 |
||
323 |
sz := file fileSize. |
|
324 |
sz ~= 200 ifTrue:[self error:'size mismatch']. |
|
325 |
||
326 |
s := file readWriteStream. |
|
327 |
s binary. |
|
328 |
s nextPutAll:(101 to:200). |
|
329 |
s close. |
|
330 |
||
331 |
sz := file fileSize. |
|
332 |
sz ~= 200 ifTrue:[self error:'size mismatch']. |
|
333 |
||
1447 | 334 |
(file binaryContentsOfEntireFile ~= |
335 |
((101 to:200) asByteArray , (101 to:200) asByteArray)) ifTrue:[ |
|
336 |
self error:'contents mismatch' |
|
75 | 337 |
]. |
338 |
||
339 |
file delete. |
|
340 |
||
341 |
" |
|
120 | 342 |
self new testRewrite2 |
75 | 343 |
" |
76 | 344 |
! |
345 |
||
346 |
testWrite1 |
|
653 | 347 |
"basic writing in various block sizes" |
76 | 348 |
|
120 | 349 |
self doTestWrite:1024. |
350 |
self doTestWrite:2048. |
|
351 |
self doTestWrite:4096. |
|
352 |
self doTestWrite:8192. |
|
353 |
self doTestWrite:8192*2. |
|
354 |
self doTestWrite:8192*4. |
|
355 |
self doTestWrite:8192*8. |
|
356 |
self doTestWrite:8192*16. |
|
357 |
self doTestWrite:8192*32. |
|
358 |
self doTestWrite:8192*64. |
|
359 |
self doTestWrite:8192*128. |
|
76 | 360 |
|
361 |
" |
|
120 | 362 |
self new testWrite1 |
76 | 363 |
" |
653 | 364 |
|
365 |
"Modified (comment): / 18-01-2012 / 12:02:34 / cg" |
|
76 | 366 |
! |
367 |
||
368 |
testWrite2 |
|
369 |
"basic writing" |
|
370 |
||
371 |
10 timesRepeat:[ |
|
1447 | 372 |
self testWrite1. |
76 | 373 |
]. |
374 |
||
375 |
" |
|
120 | 376 |
self new testWrite2 |
76 | 377 |
" |
378 |
! |
|
379 |
||
380 |
testWrite3 |
|
653 | 381 |
"writing with many interrupts" |
76 | 382 |
|
923
77b11265aac2
class: RegressionTests::FileStreamTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
893
diff
changeset
|
383 |
<timeout: 300>"5 mins" |
77b11265aac2
class: RegressionTests::FileStreamTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
893
diff
changeset
|
384 |
|
76 | 385 |
|interruptor| |
386 |
||
387 |
interruptor := [ |
|
1447 | 388 |
[true] whileTrue:[ |
389 |
Delay waitForMilliseconds:10. |
|
390 |
]. |
|
76 | 391 |
] forkAt:9. |
392 |
||
393 |
[ |
|
1447 | 394 |
50 timesRepeat:[ |
395 |
self testWrite1. |
|
396 |
]. |
|
76 | 397 |
] valueNowOrOnUnwindDo:[ |
1447 | 398 |
interruptor terminate |
76 | 399 |
]. |
400 |
||
401 |
" |
|
120 | 402 |
self new testWrite3 |
76 | 403 |
" |
653 | 404 |
|
405 |
"Modified (comment): / 18-01-2012 / 12:02:21 / cg" |
|
923
77b11265aac2
class: RegressionTests::FileStreamTest
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
893
diff
changeset
|
406 |
"Modified: / 26-04-2013 / 16:58:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1268
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
407 |
! |
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
408 |
|
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
409 |
testWriteEOLModes |
1610 | 410 |
|testFilename| |
1268
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
411 |
|
1610 | 412 |
testFilename := self testFilename. |
413 |
||
414 |
testFilename writingFileDo:[:s | |
|
415 |
s eolMode:#crlf. |
|
416 |
s nextPutLine:'hello' |
|
1268
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
417 |
]. |
1610 | 418 |
self assert:(testFilename fileSize == 7). |
419 |
self assert:(testFilename binaryContentsOfEntireFile = #[16r68 16r65 16r6C 16r6C 16r6F 16r0D 16r0A]). |
|
1268
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
420 |
|
1610 | 421 |
testFilename writingFileDo:[:s | |
422 |
s eolMode:#nl. |
|
423 |
s nextPutLine:'hello' |
|
1268
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
424 |
]. |
1610 | 425 |
self assert:(testFilename fileSize == 6). |
426 |
self assert:(testFilename binaryContentsOfEntireFile = #[16r68 16r65 16r6C 16r6C 16r6F 16r0A]). |
|
1268
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
427 |
|
1610 | 428 |
testFilename writingFileDo:[:s | |
429 |
s eolMode:#cr. |
|
430 |
s nextPutLine:'hello' |
|
1268
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
431 |
]. |
1610 | 432 |
self assert:(testFilename fileSize == 6). |
433 |
self assert:(testFilename binaryContentsOfEntireFile = #[16r68 16r65 16r6C 16r6C 16r6F 16r0D]). |
|
1268
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
434 |
|
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
435 |
"/ ------------------------ |
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
436 |
|
1611 | 437 |
testFilename writingFileDo:[:s | |
1610 | 438 |
s eolMode:#crlf. |
439 |
s nextPutAll:'hello' , Character cr |
|
1268
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
440 |
]. |
1610 | 441 |
self assert:(testFilename fileSize == 7). |
442 |
self assert:(testFilename binaryContentsOfEntireFile = #[16r68 16r65 16r6C 16r6C 16r6F 16r0D 16r0A]). |
|
1268
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
443 |
|
1611 | 444 |
testFilename writingFileDo:[:s | |
1610 | 445 |
s eolMode:#nl. |
446 |
s nextPutAll:'hello' , Character cr |
|
1268
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
447 |
]. |
1610 | 448 |
self assert:(testFilename fileSize == 6). |
449 |
self assert:(testFilename binaryContentsOfEntireFile = #[16r68 16r65 16r6C 16r6C 16r6F 16r0A]). |
|
1268
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
450 |
|
1610 | 451 |
testFilename writingFileDo:[:s | |
452 |
s eolMode:#cr. |
|
453 |
s nextPutAll:'hello' , Character cr |
|
1268
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
454 |
]. |
1610 | 455 |
self assert:(testFilename fileSize == 6). |
456 |
self assert:(testFilename binaryContentsOfEntireFile = #[16r68 16r65 16r6C 16r6C 16r6F 16r0D]). |
|
1268
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
457 |
|
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
458 |
"/ in binary mode, this should be ignored |
1610 | 459 |
testFilename writingFileDo:[:s | |
460 |
s binary. |
|
461 |
s eolMode:#crlf. |
|
462 |
s nextPutAll:'hello' , Character cr |
|
1268
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
463 |
]. |
1610 | 464 |
self assert:(testFilename fileSize == 6). |
465 |
self assert:(testFilename binaryContentsOfEntireFile = #[16r68 16r65 16r6C 16r6C 16r6F 16r0A]). |
|
1268
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
466 |
|
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
467 |
" |
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
468 |
self new testWriteEOLModes |
f1fed2016730
class: RegressionTests::FileStreamTest
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
469 |
" |
1610 | 470 |
|
1611 | 471 |
"Modified: / 14-06-2017 / 16:08:53 / mawalch" |
0 | 472 |
! ! |
473 |
||
474 |
!FileStreamTest class methodsFor:'documentation'! |
|
475 |
||
476 |
version |
|
477 |
^ '$Header$' |
|
1370 | 478 |
! |
479 |
||
480 |
version_CVS |
|
481 |
^ '$Header$' |
|
0 | 482 |
! ! |
893
bab45d7a2c6b
class: RegressionTests::FileStreamTest
Stefan Vogel <sv@exept.de>
parents:
730
diff
changeset
|
483 |