[squeak-dev] assert:equals: in Object

H. Hirzel hannes.hirzel at gmail.com
Mon Oct 26 21:46:10 UTC 2020


Hi Tim

Not fully sure what you mean, probably not
     cod (a type of fish)
     cod (cash on delivery)
     doc (the extension of an MS Word file which these days might
often be larger than a Squeak image)

:-)


a) As for the original proposal from Eliot which started this thread,
what is your conclusion?
and / or related to this


My impression is that Eliot's main concern is a smooth workflow in
moving code back and forth from an SUnit test to a workspace. As this
discussion shows this may also be adressed on the workspace level.


But for the moment he says that adding one method to class Object would help him

--Hannes


Details:
----------

A Squeak 5.3 release image has out of the box

Object subclass: #TestCase
	instanceVariableNames: 'testSelector timeout'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'SUnit-Kernel'



assert: aBooleanOrBlock

	aBooleanOrBlock value ifFalse: [self signalFailure: 'Assertion failed']	
	

	
assert: aBooleanOrBlock description: aStringOrBlock

	aBooleanOrBlock value ifFalse: [
		| description |
		description := aStringOrBlock value.
		self logFailure: description.
		TestResult failure signal: description ]
	
	

assert: expected equals: actual

	^self
		assert: expected = actual
		description: [ self comparingStringBetween: expected and: actual ]	


assert: expected equals: actual description: aString

	^self
		assert: expected = actual
		description: [ aString , ': ', (self comparingStringBetween:
expected and: actual) ]
	

		
Meanwhile class Object has

assert: aBlock
	"Throw an assertion error if aBlock does not evaluates to true."

	aBlock value ifFalse: [AssertionFailure signal: 'Assertion failed']


assert: aBlock description: aStringOrBlock
	"Throw an assertion error if aBlock does not evaluates to true."

	aBlock value ifFalse: [ AssertionFailure signal: aStringOrBlock value ]


assert: aBlock descriptionBlock: descriptionBlock
	"Throw an assertion error if aBlock does not evaluate to true."

	aBlock value ifFalse: [AssertionFailure signal: descriptionBlock
value asString ]
	
	
but no
		

assert: expected equals: actual


And this is the main request by Eliot: to have this method

assert: expected equals: actual


also in class object as I understand it.

As for me -- no objection to that.


On 10/26/20, tim Rowledge <tim at rowledge.org> wrote:
>
>
>> On 2020-10-25, at 11:40 PM, Marcel Taeumel <marcel.taeumel at hpi.de> wrote:
>>
>> > A situation where SUnit and all the tests are not necessarily loaded.
>>
>> Hmm... maybe we might consider adding an SUnit-Core? Well, not sure it
>> makes sense to have an image without SUnit. But then you might want to
>> also strip, e.g., network support to shrink the image file a little bit
>> more. :-)
>
> Once upon a time that was a big deal because memory was short. Given that I
> have been sent almost content-free Word documents that take up more space
> than a well loaded Squeak image, I suggest we probably don't need to care so
> much these days.
>
> It offends my CDO (OCD but the letters in *the right order*), but that's the
> reality.
>
>
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> It said, "Insert disk #3," but only two will fit!
>
>
>
>


More information about the Squeak-dev mailing list