Pharo test defects

Package: Ficus (tinchodias/ficus, row 17)

State
Fixed (package repair)
Defect in
see the record
Tests
0
Fix
tinchodias-ficus.st
Upstream repository
tinchodias/ficus

The record is the text of the repair. The Results table is the last run of the row.

Record

Test

Load the package into a Pharo 14 image (build 791) with the load expression of the test run, file in the fixes file of the row if there is one, and run the test classes of the package.

"row 17"
Metacello new baseline: 'Ficus'; repository: 'github://tinchodias/Ficus:mini/src'; onConflict: [:e | e useIncoming]; load.

Results

Last result of the package run (stock Cog and iospharo on the same image).

RowLabelLoadStock Cogiospharo VM
17tinchodias-ficusoktests=77 P=77 F=0 E=0 S=0 T=0 X=0tests=77 P=77 F=0 E=0 S=0 T=0 X=0

Fix

Fixes file (filed in after the load): tinchodias-ficus.st (download)
"Ficus (tinchodias/Ficus, mini): two tests that do not pass on both VMs.
See docs/upstream/package-repairs.md.

1. FiSetSimpleChangesTest>>testUpdate is marked <expectedFailure>.  The
   conversion FiSet>>editFromSimpleChange: answers a FiSubEdit for an update
   with children, while FiSetUpdate>>edit (pinned by the passing test
   FiSetChangesTest>>testUpdate) answers FiInclude value: newValue.  The
   converter now answers the same FiInclude, and the mark goes.

2. FiBuilderTest>>testErrorWhenSettingAnExcludedVariable is skipped by the
   author because the validation was removed.  The validation is back in
   FiFixedObject>>initializeFromStepsAndValues: (one membership test for each
   step), and the skip goes."

fix value: #FiSet value: #editFromSimpleChange:
	value: [ :source | source includesSubstring: 'ifUpdate: [ ].' ]
	value:
'editFromSimpleChange: aSimpleChange
	"Convert as edit, assuming the FiSimpleChange applies to myself."
	
	aSimpleChange
		ifAdd: [ ^ self editInclude: aSimpleChange newValue ] 
		ifRemove: [ ^ self editExclude: aSimpleChange oldValue ] 
		ifUpdate: [ ].
	
	"An update of an element is the edit that FiSetUpdate>>edit answers: include the new value."
	^ self editInclude: aSimpleChange newValue'.

fix value: #FiSetSimpleChangesTest value: #testUpdate
	value: [ :source | source includesSubstring: '<expectedFailure>' ]
	value:
'testUpdate
	| shot otherShot edit source intermediate change simpleChanges |
	source := FiSet new.
	shot := FiChef nickname: #A.
	otherShot := shot resultOf: (shot editAt: #shortBio equal: ''42'').

	edit := source editInclude: shot.
	intermediate := source resultOf: edit.

	edit := intermediate editInclude: otherShot.
	change := intermediate changeOf: edit.

	simpleChanges := change asSimpleChanges.

	self 
		assert: (intermediate editFromSimpleChanges: simpleChanges) 
		equals: change edit.
	
	self assert: simpleChanges equals: 
		(FiSet withValues: {
			(FiUpdate builder
				path: FiPath root / #A;
				children: (FiSet withValues: {
					(FiUpdate builder
						path: FiPath root / #A / #shortBio;
						children: FiSet new;
						newValue: ''42'';
						oldValue: '''';
						new).
					});
				newValue: (FiChef nickname: #A shortBio: ''42'');
				oldValue: (FiChef nickname: #A);
				new).
			})'.

fix value: #FiFixedObject value: #initializeFromStepsAndValues:
	value: [ :source | (source includesSubstring: 'excludedInstanceVariableNamesForSteps') not ]
	value:
'initializeFromStepsAndValues: aDictionary
	| selector excluded |
	excluded := self class excludedInstanceVariableNamesForSteps.
	self initialize.
	aDictionary
		keysAndValuesDo: [ :slotName :value | 
			(excluded includes: slotName asSymbol)
				ifTrue: [ self error: slotName asString , '' is not a step of '' , self class name ].
			selector := (slotName , '':'') asSymbol.
			
			(self respondsTo: selector)
				ifTrue: [ self perform: selector with: value ]
				ifFalse: [ [ self instVarNamed: slotName put: value ]
						on: Error
						do: [ :e | self error: slotName asString , '' not found in '' , self asString ] ] ]'.

fix value: #FiBuilderTest value: #testErrorWhenSettingAnExcludedVariable
	value: [ :source | source includesSubstring: 'self skip:' ]
	value:
'testErrorWhenSettingAnExcludedVariable

	self 
		assert: (FiRecipe excludedInstanceVariableNamesForSteps includes: #cachedHash)
		description: ''This is an assumption of this test''.
	
	self 
		should: [ 
			FiRecipe builder
				cachedHash: 123; "<- this is invalid"
				new ]
		raise: Error'.

State of 2026-11-20. Made from the test records of the iospharo project (a second Pharo VM). The fixes are proposals for review.