The record is the text of the repair. The Results table is the last run of the row.
JSGExtensionsTest compare the output for a
Dictionary and for a Set with a fixed string. The string has the elements
in the order of the image of the author. The two collections enumerate in
hash order.fixes/feenkcom-javascriptgenerator.st. The tests compare
the elements and not their order.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 24" Metacello new baseline: 'JavaScriptGenerator'; repository: 'github://feenkcom/JavaScriptGenerator:main/src'; onConflict: [:e | e useIncoming]; load.
Last result of the package run (stock Cog and iospharo on the same image).
| Row | Label | Load | Stock Cog | iospharo VM |
|---|---|---|---|---|
| 24 | feenkcom-javascriptgenerator | ok | tests=45 P=45 F=0 E=0 S=0 T=0 X=0 | tests=45 P=45 F=0 E=0 S=0 T=0 X=0 |
"JavaScriptGenerator (feenkcom/JavaScriptGenerator, main): two tests of
JSGExtensionsTest compare the output with a string that has the elements in
the order of the image of the author. A Dictionary and a Set enumerate in
hash order, and Pharo 14 gives another order (Got '{42 : ''b'' , 3 : 4 , ''a'' : 1}',
Got '{4,1,2,3}'). Stock Cog and our VM give the same result. The tests now
compare the elements and not their order. Each check of the old tests is
still there: the braces, the separators, and each element."
fix value: #JSGExtensionsTest value: #testDictionaryWriteJavaScriptOn
value: [ :source | (source includesSubstring: 'splitOn:') not ]
value:
'testDictionaryWriteJavaScriptOn
| dict string pairs |
dict := {
''a'' -> 1.
42 -> ''b''.
3 -> 4 } asDictionary.
string := String streamContents: [ :s | dict writeJavaScriptOn: s ].
"A Dictionary enumerates in hash order: compare the pairs, not their order."
self assert: string first equals: ${.
self assert: string last equals: $}.
pairs := (string copyFrom: 2 to: string size - 1) splitOn: '' , ''.
self assert: pairs size equals: 3.
self assert: pairs asSet equals: #( ''''''a'''' : 1'' ''42 : ''''b'''''' ''3 : 4'' ) asSet'.
fix value: #JSGExtensionsTest value: #testSetWriteJavaScriptOn
value: [ :source | (source includesSubstring: 'splitOn:') not ]
value:
'testSetWriteJavaScriptOn
| string elements |
string := String streamContents: [ :s | #(1 2 3 4) asSet writeJavaScriptOn: s ].
"A Set enumerates in hash order: compare the elements, not their order."
self assert: string first equals: ${.
self assert: string last equals: $}.
elements := (string copyFrom: 2 to: string size - 1) splitOn: '',''.
self assert: elements size equals: 4.
self assert: elements asSet equals: #( ''1'' ''2'' ''3'' ''4'' ) asSet.
string := String streamContents: [ :s | Set new writeJavaScriptOn: s ].
self assert: string equals: ''set()'''.
State of 2026-11-20. Made from the test records of the iospharo project (a second Pharo VM). The fixes are proposals for review.