[squeak-dev] The Trunk: Tests-eem.377.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Apr 26 02:20:42 UTC 2017


Eliot Miranda uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-eem.377.mcz

==================== Summary ====================

Name: Tests-eem.377
Author: eem
Time: 25 April 2017, 7:20:24.185589 pm
UUID: d7a0fa71-5267-4d5a-aafd-26d75bed7a33
Ancestors: Tests-eem.376

Add a test for the fixed evaluation order in inlined to:[by:]do: (with thanks to John Brant).

=============== Diff against Tests-eem.376 ===============

Item was changed:
  ----- Method: CompilerTest>>testEvaluationOfInlinedToDo (in category 'testing') -----
  testEvaluationOfInlinedToDo
  	"Whether inlined or not, #to:do: should return the same value"
  	| inlinedResult notInlinedResult |
  	inlinedResult := Compiler new
  				evaluate: '1+1 to: 0 do: [:i | ]'
  				in: nil
  				to: nil
  				notifying: nil 
  				ifFail: [^ #failedDoit].
  	notInlinedResult := Compiler new
  				evaluate: '| aBlock | aBlock := [:i | ]. 1+1 to: 0 do: aBlock'
  				in: nil
  				to: nil
  				notifying: nil 
  				ifFail: [^ #failedDoit].
+ 	self assert: inlinedResult = notInlinedResult.
+ 	inlinedResult := Compiler new
+ 						evaluate: '| stream results | 
+ 									stream := ReadStream on: #(2 1).
+ 									results := OrderedCollection new.
+ 									stream next to: stream next do: [ :i | results add: i ].
+ 									results'
+ 						in: nil
+ 						to: nil
+ 						notifying: nil 
+ 						ifFail: [^ #failedDoit].
+ 	self assert: inlinedResult isEmpty.
+ 	inlinedResult := Compiler new
+ 						evaluate: '| stream results | 
+ 									stream := ReadStream on: #(1 2).
+ 									results := OrderedCollection new.
+ 									stream next to: stream next do: [ :i | results add: i ].
+ 									results'
+ 						in: nil
+ 						to: nil
+ 						notifying: nil 
+ 						ifFail: [^ #failedDoit].
+ 	self assert: inlinedResult asArray = #(1 2)!
- 	self assert: inlinedResult = notInlinedResult!



More information about the Squeak-dev mailing list