Pharo test defects

MicMetaDataBlockTest

State
Fixed (image fix)
Defect in
the test
Tests
1
Fix
image fix 20-MicMetaDataBlockTest.st
Upstream repository
pillar-markup/Microdown

Record

The test called self skip as its first statement, then asserted that a freshly created MicMetaDataBlock has a non-nil body. That expectation is obsolete. MicMetaDataBlock>>initialize has the line "body := SmallDictionary new" commented out. MicStartStopMarkupBlock>>bodyFromLine: collects the block's lines with "body := body ifNil: [ line ] ifNotNil: [ body , String cr , line ]", so body must start as nil. MicMetaDataBlock>>closeMe then parses the collected text with STONJSON into the metadata dictionary. I replaced the test with one that feeds a line to a new block, calls closeMe, and asserts the dictionary exists, holds the right value, and bogusParsing is false. No code under test was changed. The new test passes on both VMs.

Test Defect in State Cause
MicMetaDataBlockTest>>testCreatingAnInstanceInitializeTheMetadatDictionary test repaired The test was unconditionally skipped and asserted something the design no longer does. body is nil on a new instance and becomes the metadata dictionary at closeMe. The rewritten test checks that lifecycle and asserts body isNotNil, (metadata at: 'authors') equals 'S. Ducasse', and deny bogusParsing.

Regression check: I ran the whole MicMetaDataBlockTest class 3 times on our VM and 3 times on Cog, on the fixed images. Each run gave 21 of 21 PASS. I did not run the class on the unfixed images, so I have no before count from this session; the cluster file only shows this one test as SKIP on both VMs, so the other 20 should have passed before. I changed only a test method and no non-test method, so no other test class needed a regression run. I did not run the nojit variant of our VM.

Upstream note: Title: Microdown: MicMetaDataBlockTest replace obsolete skipped test. Description: testCreatingAnInstanceInitializeTheMetadatDictionary calls self skip and expects a non-nil body on a new MicMetaDataBlock. MicMetaDataBlock>>initialize has the SmallDictionary initialization commented out, and MicStartStopMarkupBlock>>bodyFromLine: needs body to start as nil. The test now checks that closeMe turns the collected line into the metadata dictionary. The change is in the Microdown project, which is external to the pharo repository; the owner must review it before any upstream pull request.

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
MicMetaDataBlockTest>>testCreatingAnInstanceInitializeTheMetadatDictionarySKIPrepairedPASSPASSPASS 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)."
((MicMetaDataBlockTest selector: #testCreatingAnInstanceInitializeTheMetadatDictionary) run) printString.

Source of the tests before the fix

MicMetaDataBlockTest>>testCreatingAnInstanceInitializeTheMetadatDictionary before the fix (Pharo 14 build 791)
testCreatingAnInstanceInitializeTheMetadatDictionary

	| metadata |
	self skip.
	metadata := MicMetaDataBlock new.
	self assert: metadata body isNotNil

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-MicMetaDataBlockTest.st (download)
fix value: #MicMetaDataBlockTest value: #testCreatingAnInstanceInitializeTheMetadatDictionary
	value: [ :s | s includesSubstring: 'self skip' ]
	value: 'testCreatingAnInstanceInitializeTheMetadatDictionary

	"MicStartStopMarkupBlock>>bodyFromLine: collects the lines of the block in body, starting from nil (the initialization to a SmallDictionary is commented out in MicMetaDataBlock>>initialize).  closeMe turns the collected text into the metadata dictionary.  So the dictionary exists after closeMe, not after new."

	| metadata |
	metadata := MicMetaDataBlock new.
	metadata bodyFromLine: ''"authors" : "S. Ducasse"''.
	metadata closeMe.
	self assert: metadata body isNotNil.
	self assert: (metadata atKey: ''authors'') equals: ''S. Ducasse''.
	self deny: metadata bogusParsing'.

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