Chris Muller uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-cmm.61.mcz==================== Summary ====================
Name: Tests-cmm.61
Author: cmm
Time: 15 March 2010, 12:19:05.306 pm
UUID: 4f5f2626-6ef6-492b-85d6-7ea0c4a8c057
Ancestors: Tests-cmm.60
Fixed testReadIntoStartingAtCount.
=============== Diff against Tests-cmm.60 ===============
Item was changed:
----- Method: FileStreamTest>>testReadIntoStartingAtCount (in category 'as yet unclassified') -----
testReadIntoStartingAtCount
| filename file |
filename := 'filestream.tst'.
[ | writeBuffer readBuffer bytesRead |
writeBuffer := (ByteArray new: 2500)
atAllPut: 1 ;
yourself.
(StandardFileStream forceNewFileNamed: filename)
binary ;
nextPutAll: writeBuffer ;
close.
file := StandardFileStream readOnlyFileNamed: filename.
readBuffer := ByteArray new: 400.
bytesRead := file
readInto: readBuffer
startingAt: 10
count: 100.
self assert: bytesRead = 100.
"quick test"
+ self assert: (readBuffer occurrencesOf: 1) = 100.
- self assert: (bytesRead occurrencesOf: 1) = 100.
"compare test"
1 to: readBuffer size do:
[ : n | self assert:
+ ((readBuffer at: n) = (n between: 10 and: 10 + 100 - 1)
- ((readBuffer at: n) = (n between: 10 and: 10 + 100)
ifTrue: [ (writeBuffer at: n) ]
ifFalse: [ 0 ]) ] ]
ensure:
[ file ifNotNil: [ file close ].
FileDirectory default
deleteFileNamed: filename
ifAbsent: [ "ok" ] ]!