The Trunk: KernelTests-eem.339.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.339.mcz

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

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

Name: KernelTests-eem.339
Author: eem
Time: 27 March 2018, 11:42:08.383576 am
UUID: 8c45b1d4-42d5-405e-888d-9fc6a5418e2c
Ancestors: KernelTests-eem.338

comment that last stipulation

=============== Diff against KernelTests-eem.338 ===============

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).
+ "The selector of a method should never be found (unless it occurs as a literal or in a pragma)"
  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)]]!