pharo-smalltalk
pharo-smalltalk copied to clipboard
Generate #asArray send in tests
The following is a typical test...
FlattenArrayTest >> test01_NoNesting [
| result |
result := flattenArrayCalculator flattenArray: #(0 1 2 ) .
self assert: result equals: #(0 1 2 )
Personally use OrderedCollection much more often than Arrays, and such an assert line forces #asArray to be sent before returning the solution, which is irrelevant noise for the student to deal with.
I propose the #asArray send be generated as part of the test...
FlattenArrayTest >> test01_NoNesting [
| result |
result := flattenArrayCalculator flattenArray: #(0 1 2 ) .
self assert: result asArray equals: #(0 1 2 )
Its a non-breaking change and existing solutions can be updated as time permits.