The Inbox: Tests-HenrikSperreJohansen.82.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Tests-HenrikSperreJohansen.82.mcz

commits-2
A new version of Tests was added to project The Inbox:
http://source.squeak.org/inbox/Tests-HenrikSperreJohansen.82.mcz

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

Name: Tests-HenrikSperreJohansen.82
Author: HenrikSperreJohansen
Time: 27 May 2010, 2:20:17.48 pm
UUID: bf33877c-d5ae-4b9e-b3bf-753289ae9821
Ancestors: Tests-eem.81

Test for the cases described in Compiler-HenrikSperreJohansen.144

=============== Diff against Tests-eem.81 ===============

Item was added:
+ ----- Method: ClosureCompilerTest>>testBlockDoitDecompilation (in category 'tests') -----
+ testBlockDoitDecompilation
+ "Tests that decompile of a doit block with remote vars executes correcly"
+ "Tests that decompilation of a Block, when 'method' of block is equivalent to that compiled by a DoIt, preserves the temp names "
+
+ |blockSourceStream methodNode compiledMethod block decompiledBlock|
+ blockSourceStream := '|x y| [:a :b | x := a. y := b. x + y]' readStream.
+ methodNode := nil class evaluatorClass new
+ from: blockSourceStream class: nil class context: nil notifying: nil;
+ translate: blockSourceStream noPattern: true ifFail: [nil].
+ compiledMethod := methodNode generateWithTempNames.
+ block := nil withArgs: #() executeMethod: compiledMethod.
+
+ self shouldnt: [decompiledBlock := block decompile] raise: Error.
+ self assert: '{[:a :b |
+ x := a.
+ y := b.
+ x + y]}' equals: decompiledBlock printString
+ !