X Tutup
Skip to content

Commit 3de3493

Browse files
author
Johan Brichau
committed
More complete test for GRPlatform>>thisContext
1 parent 03393b6 commit 3de3493

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
private
2+
returnSender
3+
^ GRPlatform current thisContext sender
Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
tests-processes
1+
tests
22
testThisContext
3-
| methodContext |
4-
methodContext := self platform thisContext.
5-
[
6-
| blockContext |
7-
blockContext := self platform thisContext.
8-
self assert: blockContext sender = methodContext ]
9-
value
3+
| methodContext block |
4+
methodContext := self platform thisContext.
5+
block := [ | blockContext |
6+
blockContext := self platform thisContext.
7+
self assert: blockContext sender = methodContext.
8+
"The following is a difference between Gemstone and Pharo... "
9+
(Smalltalk includesKey: #GRGemStonePlatform)
10+
ifTrue: [ self assert: blockContext receiver = block ]
11+
ifFalse: [
12+
self assert: blockContext receiver = self.
13+
self assert: (blockContext namedTempAt: (blockContext tempNames indexOf: #blockContext)) == blockContext ].
14+
self assert: (blockContext namedTempAt: (blockContext tempNames indexOf: #methodContext)) == methodContext ].
15+
block value.
16+
self assert: self returnSender = methodContext.
17+
self assert: methodContext receiver = self.
18+
self assert: (self platform thisContext namedTempAt: (self platform thisContext tempNames indexOf: #block)) == block

0 commit comments

Comments
 (0)
X Tutup