-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make thisContext test work for Squeak
- Loading branch information
Johan Brichau
committed
Apr 9, 2022
1 parent
74f54ab
commit 1d8daee
Showing
2 changed files
with
21 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 20 additions & 11 deletions
31
repository/Grease-Tests-Core.package/GRPlatformTest.class/instance/testThisContext.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
tests | ||
testThisContext | ||
| methodContext block | | ||
| methodContext block ctx | | ||
"This is just a basic test to see if thisContext works" | ||
methodContext := self platform thisContext. | ||
block := [ | blockContext | | ||
blockContext := self platform thisContext. | ||
self assert: blockContext sender = methodContext. | ||
"The following is a difference between Gemstone and Pharo... " | ||
(Smalltalk includesKey: #GRGemStonePlatform) | ||
ifTrue: [ self assert: blockContext receiver = block ] | ||
ifFalse: [ | ||
self assert: blockContext receiver = self. | ||
self assert: (blockContext tempNamed: 'blockContext') == blockContext ]. | ||
self assert: (blockContext tempNamed: 'methodContext') == methodContext ]. | ||
blockContext := self platform thisContext. | ||
self assert: blockContext sender = methodContext. | ||
"The following is a difference between Gemstone and Pharo... " | ||
(Smalltalk includesKey: #GRGemStonePlatform) | ||
ifTrue: [ self assert: blockContext receiver = block ] | ||
ifFalse: [ | ||
self assert: blockContext receiver = self. | ||
(blockContext respondsTo: #tempNamed:) | ||
ifTrue:[ self assert: (blockContext tempNamed: 'blockContext') == blockContext ] | ||
ifFalse:[ self assert: (blockContext namedTempAt: (blockContext tempNames indexOf: #blockContext)) == blockContext ] ]. | ||
(blockContext respondsTo: #tempNamed:) | ||
ifTrue:[ self assert: (blockContext tempNamed: 'methodContext') == methodContext ] | ||
ifFalse: [ self assert: (blockContext namedTempAt: (blockContext tempNames indexOf: #methodContext)) == methodContext ] ]. | ||
|
||
block value. | ||
self assert: self returnSender = methodContext. | ||
self assert: methodContext receiver = self. | ||
self assert: (self platform thisContext tempNamed: 'block') == block | ||
ctx := self platform thisContext. | ||
(ctx respondsTo: #tempNamed:) | ||
ifTrue:[ self assert: (ctx tempNamed: 'block') == block ] | ||
ifFalse: [ self assert: (ctx namedTempAt: (ctx tempNames indexOf: #block)) == block ] |