The Trunk: Tests-eem.440.mcz

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

The Trunk: Tests-eem.440.mcz

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

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

Name: Tests-eem.440
Author: eem
Time: 9 October 2020, 12:51:35.424652 pm
UUID: 0ef6e6e7-af79-4a08-9a66-734fb771f2c2
Ancestors: Tests-eem.439

Provide a less superficial test for the full block method copying bug.  test both the most superficial form of the bug and a deeper form.

=============== Diff against Tests-eem.439 ===============

Item was changed:
  ----- Method: CompilerTest>>foo (in category 'private') -----
  foo
+ ^[{thisContext method method. thisContext home method}] value
+
+ "CompilerTest compile: (CompilerTest sourceCodeAt: #foo) classified: #private"
+ "self new foo first == self new foo second"!
- ^[{thisContext method method. thisContext home method}] value!

Item was added:
+ ----- Method: CompilerTest>>fubar (in category 'private') -----
+ fubar
+ ^[[[[{thisContext method method. thisContext home method}] value ] value ] value ] value
+
+ "CompilerTest compile: (CompilerTest sourceCodeAt: #fubar) classified: #private"
+ "self new fubar first == self new fubar second"!

Item was changed:
  ----- Method: CompilerTest>>testValidFullBlockMethod (in category 'tests - code generation') -----
  testValidFullBlockMethod
+ "Check that the full block system creates properly connected methods
+ whose constituent blocks refer back to the correct method."
+ #(foo fubar) do:
+ [:selector| | fooMethod |
+ fooMethod := self class >> selector.
+ fooMethod encoderClass supportsFullBlocks ifFalse:
+ [self class compileMethodToUseFullBlocks: selector.
+ fooMethod := self class >> selector].
+ self assert: fooMethod encoderClass supportsFullBlocks.
+ self assert: ((fooMethod literalAt: 1) isCompiledCode and: [(fooMethod literalAt: 1) isCompiledBlock]).
+ self assert: (fooMethod literalAt: 1) method == fooMethod.
+ "And if it looks safe to do so, actually run foo and check its result"
+ (CompiledCode primaryBytecodeSetEncoderClass supportsFullBlocks
+ or: [CompiledCode secondaryBytecodeSetEncoderClass supportsFullBlocks]) ifTrue:
+ [self assert: {fooMethod. fooMethod } equals: (self perform: selector)]]!
- | fooMethod |
- fooMethod := self class >> #foo.
- fooMethod encoderClass supportsFullBlocks ifFalse:
- [self class compileMethodToUseFullBlocks: #foo.
- fooMethod := self class >> #foo].
- self assert: fooMethod encoderClass supportsFullBlocks.
- self assert: ((fooMethod literalAt: 1) isCompiledCode and: [(fooMethod literalAt: 1) isCompiledBlock]).
- self assert: (fooMethod literalAt: 1) method == fooMethod.
- "And if it looks safe to do so, actually run foo and check its result"
- (CompiledCode primaryBytecodeSetEncoderClass supportsFullBlocks
- or: [CompiledCode secondaryBytecodeSetEncoderClass supportsFullBlocks]) ifTrue:
- [self assert: {fooMethod. fooMethod } equals: self foo]!