[squeak-dev] The Inbox: Tests-nice.431.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Apr 25 16:22:58 UTC 2020


Nicolas Cellier uploaded a new version of Tests to project The Inbox:
http://source.squeak.org/inbox/Tests-nice.431.mcz

==================== Summary ====================

Name: Tests-nice.431
Author: nice
Time: 25 April 2020, 6:22:55.980578 pm
UUID: b1757425-0f7a-4912-8f40-561468f42bba
Ancestors: Tests-mt.430

Restore #testFinalizationOfEquals

The method was failing, a discussion occurred on mantis, and an updated test was proposed
http://bugs.squeak.org/view.php?id=6347

In the interim, the method was removed in System-edc.102 putting it out of the radar
(this was a drastic way of *fixing the failing test*)

This is an attempt to revisit the verbose version of the test.

=============== Diff against Tests-mt.430 ===============

Item was added:
+ ----- Method: ObjectFinalizerTests>>assertThat:after: (in category 'running') -----
+ assertThat: conditionBlock after: actionBlock
+ 	"syntactic sugar for the scenario"
+ 	actionBlock value.
+ 	self should: conditionBlock.!

Item was added:
+ ----- Method: ObjectFinalizerTests>>assertThat:and:after: (in category 'running') -----
+ assertThat: preconditionBlock and: precondition2 after: actionBlock
+ 	"syntactic sugar for the scenario"
+ 	actionBlock value.
+ 	self should: preconditionBlock.
+ 	self should: precondition2!

Item was added:
+ ----- Method: ObjectFinalizerTests>>testFinalizationOfEquals (in category 'tests') -----
+ testFinalizationOfEquals
+ 	"self run: #testFinalizationOfEquals"
+ 	
+ 	"THE MENU:"
+ 	| settingUpAPairOfObjects o1 o2
+ 		objectsAreEqual
+ 		ofDifferentIdentity
+ 	registeringAFinalizationActionForEachObject
+ 		noActionIsTriggered
+ 	forcingFinalizationOfObjects
+ 		bothActionsAreTriggered |
+ 
+ 	"THE COOK:"
+ 	settingUpAPairOfObjects :=
+ 		[o1 := 'hello' copy.
+ 		 o2 := 'hello' copy].
+ 	registeringAFinalizationActionForEachObject :=
+ 		[o1 toFinalizeSend: #add: to: log with: 'first object finalized'.
+ 		 o2 toFinalizeSend: #add: to: log with: 'second object finalized'].
+ 	forcingFinalizationOfObjects :=
+ 		[o1 := o2 := nil. Smalltalk garbageCollect].
+ 	
+ 	objectsAreEqual := [o1 = o2].
+ 	ofDifferentIdentity := [o1 ~~ o2].
+ 	noActionIsTriggered := [log size = 0].
+ 	bothActionsAreTriggered := [log asSet size = 2].
+ 
+ 	"THE DINNER:"
+ 	self
+ 		assertThat: objectsAreEqual
+ 		and: ofDifferentIdentity
+ 		after: settingUpAPairOfObjects.
+ 	self
+ 		assertThat: noActionIsTriggered
+ 		after: registeringAFinalizationActionForEachObject.
+ 	self
+ 		assertThat: bothActionsAreTriggered
+ 		after: forcingFinalizationOfObjects!



More information about the Squeak-dev mailing list