Pharo test defects

OCRengineTest

State
Fixed (image fix)
Defect in
the test
Tests
1
Fix
image fix 20-OCRengineTest.st
Upstream repository
pharo-project/pharo

Record

The test had a leftover self skip as its first statement. With the skip removed, the assertion (whichUpNodeDefines: 'each' on the variable node inside a block returns the OCBlockNode) passes on both VMs. The code under test (OCProgramNode>>whichUpNodeDefines:) was already correct. The fix is a guarded replacement of the test method without the skip. The assertion is unchanged.

Test Defect in State Cause
OCRengineTest>>testWhichUNodesDefinesBlockArg test repaired Test method started with an unconditional self skip; the underlying code works.

Regression check: The whole OCRengineTest class was run on ours (JIT) and Cog with and without the fix. Ours: base 36 pass and 1 skip, fixed 37 pass. Cog: base 36 pass and 1 skip, fixed 37 pass. No non-test method was changed, so no other classes were run.

Upstream note: Pharo: Refactoring-Transformations-Tests, OCRengineTest>>testWhichUNodesDefinesBlockArg. Remove the stale self skip; the test passes as written because OCProgramNode>>whichUpNodeDefines: returns the OCBlockNode for a block argument.

Results

Last full sweeps of 2026-11-17: iospharo (sweep14-new14) and stock Cog with the Cog changes (sweepcogp14-new10), with all image fixes. "Before" is the state of the test before the repairs. The Stock Cog column has a value only where the record measured stock Cog: "PASS 3 of 3 (repair run)" is the check of each repair on stock Cog v12.0.6 with the fix entry; "-" is not measured separately.

TestBeforeStateiospharo VMPatched CogStock Cog
OCRengineTest>>testWhichUNodesDefinesBlockArgSKIPrepairedPASSPASSPASS 3 of 3 (repair run)

Test

Run the tests in a Pharo 14 image (build 791). Before the fix they skip, fail or carry the expected-failure mark.

"Run in a Playground of a Pharo 14 image (Do it and print each line)."
((OCRengineTest selector: #testWhichUNodesDefinesBlockArg) run) printString.

Source of the tests before the fix

OCRengineTest>>testWhichUNodesDefinesBlockArg before the fix (Pharo 14 build 791)
testWhichUNodesDefinesBlockArg

	| ast |
	self skip.
	ast := OCParser parseMethod: 'whoDefines

[ :each | ^ each ]	
	'.
	self assert: (ast body children first body children first value whichUpNodeDefines: 'each') class equals: OCBlockNode

Fix

How to apply an entries file: file in 00-header.st and the entries file as one chunk (the iospharo script scripts/gen-image-fixes.py makes that chunk). Each entry checks for the defect first and prints FIXED, ADDED or SKIP. Download 00-header.st.

20-OCRengineTest.st (download)
fix value: #OCRengineTest value: #testWhichUNodesDefinesBlockArg value: [ :s | s includesSubstring: 'self skip' ] value: 'testWhichUNodesDefinesBlockArg

	| ast |
	ast := OCParser parseMethod: ''whoDefines

[ :each | ^ each ]	
	''.
	self assert: (ast body children first body children first value whichUpNodeDefines: ''each'') class equals: OCBlockNode'.

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