pharo-smalltalk icon indicating copy to clipboard operation
pharo-smalltalk copied to clipboard

Generate #asArray send in tests

Open bencoman opened this issue 5 years ago • 0 comments

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.

bencoman avatar May 28 '19 01:05 bencoman