About use of specific error

Markus Gaelli gaelli at emergent.de
Fri Mar 3 11:35:48 UTC 2006


On Mar 3, 2006, at 12:22 PM, Markus Gaelli wrote:

> IntervalTest >> testRemove
> 	|anInterval|
>
>         self should: [(1 to: 3) remove: 2] raise: PreconditionError
> 	anInterval := 1 to: 3.
> 	anInterval remove: 3.
> 	self assert: (anInterval = (1 to: 2))
>
>

Actually mathematically speaking it is certainly correct to remove 2  
from (1 to: 3)  as (1 to: 3 by: 2) is an Interval too... ;-)

So I correct above "method test suite" into:

IntervalTest >> testRemove
	|anInterval|

         self should: [(1 to: 4) remove: 2] raise: PreconditionError.
	anInterval := 1 to: 3.
	anInterval remove: 2.
	self assert: (anInterval = (1 to: 3 by: 2)).
	anInterval := 1 to: 3.
	anInterval
		remove: 3;
		remove: 1;
		remove: 2.
	self assert: anInterval isEmpty

Cheers,

Markus





More information about the Squeak-dev mailing list