[squeak-dev] The Inbox: CollectionsTests-dtl.212.mcz
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Sun Jan 19 16:41:13 UTC 2014
It's a bug. Let's remove the optimizatoin. If we really want it, this could
be a implemented like
WriteStream>>sharedContents | sz | ^(sz := position max: readLimit) =
collection size ifTrue: [collection] ifFalse: [collection copyFrom: 1 to:
sz]
2014/1/19 David T. Lewis <lewis at mail.msen.com>
> 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.
> > +
> > + !
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140119/d429dbdb/attachment.htm
More information about the Squeak-dev
mailing list
|