[Bug] SortedCollection addLast works

Stephane Ducasse ducasse at iam.unibe.ch
Fri Dec 21 15:14:15 UTC 2001


hi

#(3 2 4) asSortedCollection addLast: 1 ; yourself

-> a SortedCollection(2 3 4 1)

Quite funny indeed!!!!

SortedCollection addLast should raise an error.
I tried to fix but the borwser was not working anymore :(((((( really cool
to add something into a SortedCollection without using the right protocol

I will try to fix this later. For the moment attached is a test that
represents the problem.



-------------- next part --------------
TestCase subclass: #SortedCollectionTest
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Collection-SequenceableTest'!

!SortedCollectionTest methodsFor: 'tests' stamp: 'sd 12/21/2001 16:10'!
testAddLastShouldNotImplement
	"(self selector: #testAddLastShouldNotImplement) debug"

	self should: [#(3 2 4) asSortedCollection addFirst: 1 ] raise: Error.
	self should: [#(3 2 4) asSortedCollection addLast: 1 ] raise: Error.
	! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

SortedCollectionTest class
	instanceVariableNames: ''!


More information about the Squeak-dev mailing list