The Trunk: KernelTests-eem.338.mcz

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

The Trunk: KernelTests-eem.338.mcz

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

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

Name: KernelTests-eem.338
Author: eem
Time: 27 March 2018, 11:39:37.221317 am
UUID: 70d48127-ccfe-4108-9e9e-4db931a396c4
Ancestors: KernelTests-cbc.337

The selector of a method should not be found when looking for literals irrespective of thorough search.  Make the LiteralRefLocatorTest reflect this.

=============== Diff against KernelTests-cbc.337 ===============

Item was changed:
  ----- Method: LiteralRefLocatorTest>>testThoroughFindLiteralsInBytecode (in category 'tests') -----
  testThoroughFindLiteralsInBytecode
  "Create a method referencing integers, characters, special selectors and nil, true & false.
  Compile it and check that the objects are found."
  | literals problem primary secondary |
  literals := #(-1 0 1 $0 $1 1.0 #[1 2 3 4] 'one' #one nil true false NaN).
  problem := Float bindingOf: #NaN.
  primary := CompiledCode classPool at: #PrimaryBytecodeSetEncoderClass.
  secondary := CompiledCode classPool at: #SecondaryBytecodeSetEncoderClass.
  { primary. secondary } do:
  [:encoderClass| | method |
  #(('' '') ('^[' ']')) do: "And the locators should work whether in a block or not"
  [:pFixes|
  "NaN's binding should still be found even though (Float bindingOf: #NaN) ~= (Float bindingOf: #NaN)"
  method := (Parser new
  encoderClass: encoderClass;
  parse: 'foo ', pFixes first, '^NaN', pFixes last class: Float)
  generate: CompiledMethodTrailer empty.
  [:literal|
  self assert: (method
  refersTo: literal
  primaryBytecodeScanner: (primary scanBlockOrNilForLiteral: literal)
  secondaryBytecodeScanner: (secondary scanBlockOrNilForLiteral: literal)
  thorough: false).
  self assert: (method
  refersTo: literal
  primaryBytecodeScanner: (primary scanBlockOrNilForLiteral: literal)
  secondaryBytecodeScanner: (secondary scanBlockOrNilForLiteral: literal)
+ thorough: true).
+ self deny: (method
+ refersTo: method selector
+ primaryBytecodeScanner: (primary scanBlockOrNilForLiteral: literal)
+ secondaryBytecodeScanner: (secondary scanBlockOrNilForLiteral: literal)
+ thorough: false).
+ self deny: (method
+ refersTo: method selector
+ primaryBytecodeScanner: (primary scanBlockOrNilForLiteral: literal)
+ secondaryBytecodeScanner: (secondary scanBlockOrNilForLiteral: literal)
  thorough: true)] value: problem.
 
  "All the literals should be found in a thorough search, but not otherwise"
  method := (Parser new
  encoderClass: encoderClass;
  parse: 'foo ', pFixes first, '^', literals storeString, pFixes last class: Float)
  generate: CompiledMethodTrailer empty.
  literals, {problem. problem key} do:
  [:literal|
  self deny: (method
  refersTo: literal
  primaryBytecodeScanner: (primary scanBlockOrNilForLiteral: literal)
  secondaryBytecodeScanner: (secondary scanBlockOrNilForLiteral: literal)
  thorough: false).
  self assert: (method
  refersTo: literal
  primaryBytecodeScanner: (primary scanBlockOrNilForLiteral: literal)
  secondaryBytecodeScanner: (secondary scanBlockOrNilForLiteral: literal)
  thorough: true)]].
 
  "Likewise if in a pragma"
  method := (Parser new
  encoderClass: encoderClass;
  parse: 'foo <pragma: ', literals storeString, ' with: ', problem key storeString, '>' class: Float)
  generate: CompiledMethodTrailer empty.
  literals, {problem. problem key} do:
  [:literal|
  self deny: (method
  refersTo: literal
  primaryBytecodeScanner: (primary scanBlockOrNilForLiteral: literal)
  secondaryBytecodeScanner: (secondary scanBlockOrNilForLiteral: literal)
  thorough: false).
  self assert: (method
  refersTo: literal
  primaryBytecodeScanner: (primary scanBlockOrNilForLiteral: literal)
  secondaryBytecodeScanner: (secondary scanBlockOrNilForLiteral: literal)
  thorough: true)]]!