Skip to content

Commit

Permalink
Fix Pharo 11 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jecisc committed Oct 11, 2023
1 parent 56fda6f commit 86eceec
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/Hermes-Tests-Classes/HETeSimpleClassWithBlocks.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ Class {
{ #category : #'test methods' }
HETeSimpleClassWithBlocks >> aMethodWithABlock [

^ [
self.
42 ]
]

{ #category : #'test methods' }
HETeSimpleClassWithBlocks >> aMethodWithAContantBlock [

^ [ 42 ]
]

Expand All @@ -25,9 +33,12 @@ HETeSimpleClassWithBlocks >> aMethodWithNestedBlocks [

passedTheEnsure := false.

^ [ [ 42 ] on: Error
do: [ ^ self halt ] ]
ensure: [ passedTheEnsure := true ].
^ [
[
self.
42 ]
on: Error
do: [ ^ self halt ] ] ensure: [ passedTheEnsure := true ]
]

{ #category : #'test methods' }
Expand Down
18 changes: 18 additions & 0 deletions src/Hermes-Tests/HEInstallerClassesWithBlocksTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ HEInstallerClassesWithBlocksTest >> testAMethodWithASingleBlockHasCorrectBinding

]

{ #category : #tests }
HEInstallerClassesWithBlocksTest >> testAMethodWithASingleConstantBlockHasCorrectBindingToTheHomeMethod [

| methodWithSimpleBlock block |
methodWithSimpleBlock := aClass >> #aMethodWithAContantBlock.
block := methodWithSimpleBlock literals at: 1.

self flag: #pharo10. "This can be simplified once Pharo 11 will be the minimal version for Hermes.
In Pharo < 11, this will be a compiled block while in other cases il will be a constant block."
SystemVersion current major >= 11
ifTrue: [
self assert: block isBlock.
self assert: (block compiledBlock allLiterals at: 2) equals: methodWithSimpleBlock ]
ifFalse: [
self assert: block isCompiledBlock.
self assert: (block allLiterals at: 2) equals: methodWithSimpleBlock ]
]

{ #category : #tests }
HEInstallerClassesWithBlocksTest >> testAMethodWithNestedBlocksHasCorrectBindingOfTheHomeBlockInTheNested [

Expand Down

0 comments on commit 86eceec

Please sign in to comment.