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