[squeak-dev] The Inbox: CollectionsTests-dtl.212.mcz

David T. Lewis lewis at mail.msen.com
Sun Jan 19 15:57:25 UTC 2014


This goes in the inbox because I am not sure if it should be treated
as a bug or as an acceptable limitation that needs to be documented.

Dave


On Sun, Jan 19, 2014 at 03:43:45PM +0000, commits at source.squeak.org wrote:
> David T. Lewis uploaded a new version of CollectionsTests to project The Inbox:
> http://source.squeak.org/inbox/CollectionsTests-dtl.212.mcz
> 
> ==================== Summary ====================
> 
> Name: CollectionsTests-dtl.212
> Author: dtl
> Time: 19 January 2014, 10:43:43.125 am
> UUID: 6916414f-dda9-4b64-a4ee-f5f50aacd4c4
> Ancestors: CollectionsTests-dtl.211
> 
> Add OrderedCollectionTest>>testStreamContentsPositioning.
> 
> String class>>new:streamContents: optimizes performance by answering originalCollection in the case of a stream positioned to the size of its original collection. This fails if the stream has been repositioned backwards to its original length.
> 
> The optimization was introduced in Collections-ar.129 which merges Collections-ul.128 from inbox:
> 
> - introduced #new:streamContents: in SequenceableCollection class. It's like #streamContents: but if you know the size of the new collection this method doesn't copy the result.
> - updated SequenceableCollection class >> #streamContents: to use #new:streamContents:, kept the original default size 100.
> 
> =============== Diff against CollectionsTests-dtl.211 ===============
> 
> Item was added:
> + ----- Method: OrderedCollectionTest>>testStreamContentsPositioning (in category 'testStreaming') -----
> + testStreamContentsPositioning
> + 	"String class>>new:streamContents: optimizes performance by answering the
> + 	originalCollection in the case of a stream positioned to the size of the original
> + 	collection. This fails if the stream has been repositioned backwards to its original
> + 	length."
> + 
> + 	"(OrderedCollectionTest selector: #testStreamContentsPositioning) debug"
> + 
> + 	| s |
> + 	s := String new: 10 streamContents: [ :strm |
> + 			strm nextPutAll: 'XXXXX'.
> + 			self assert: 'XXXXX' equals: strm contents.
> + 			strm nextPut: $X.
> + 			self assert: 'XXXXXX' equals: strm contents.
> + 			strm position: strm position - 1.
> + 			self assert: 'XXXXX' equals: strm contents.
> + 			strm nextPutAll: 'XXXXX'.
> + 			self assert: 'XXXXXXXXXX' equals: strm contents.
> + 			strm nextPut: $X.
> + 			self assert: 'XXXXXXXXXXX' equals: strm contents.
> + 			strm position: strm position - 1.
> + 			self assert: 'XXXXXXXXXX' equals: strm contents.
> + 		].
> + 	self assert: 10 equals: s size.
> + 	self assert: 'XXXXXXXXXX' equals: s.
> + 	
> + 	!
> 


More information about the Squeak-dev mailing list