Skip to content

Commit 417a4c3

Browse files
author
JMLF
committed
Tests in MethodMapExample splited between FullBlock and CleanBlock + CleanBlock unreleated test fix
1 parent d526574 commit 417a4c3

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

src/OpalCompiler-Tests/MethodMapExamples.class.st

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ MethodMapExamples >> exampleAccessOuterFromCleanBlock [
2424
^[ thisContext tempNamed: 'b' ] value
2525
]
2626

27+
{ #category : 'examples' }
28+
MethodMapExamples >> exampleAccessOuterFromFullBlock [
29+
<compilerOptions: #(- optionCleanBlockClosure)>
30+
| b |
31+
b := 1.
32+
^[ thisContext tempNamed: 'b' ] value
33+
]
34+
2735
{ #category : 'examples' }
2836
MethodMapExamples >> exampleConstantBlock [
2937

src/OpalCompiler-Tests/MethodMapTest.class.st

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,16 @@ MethodMapTest >> testDeadContextSourceNode [
113113

114114
{ #category : 'tests - temp access' }
115115
MethodMapTest >> testExampleAccessOuterFromCleanBlock [
116-
self assert: (self compileAndRunExample: #exampleAccessOuterFromCleanBlock) equals: 1
116+
"Should rise an exception since we are trying to access outerContext from a clean block"
117+
self should: [(self compileAndRunExample: #exampleAccessOuterFromCleanBlock)] raise: Exception.
118+
119+
]
120+
121+
{ #category : 'tests - temp access' }
122+
MethodMapTest >> testExampleAccessOuterFromFullBLock [
123+
124+
self assert: (self compileAndRunExample: #exampleAccessOuterFromFullBlock) equals: 1
125+
117126
]
118127

119128
{ #category : 'tests - temp access' }

src/OpalCompiler-Tests/OCContextTempMappingTest.class.st

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ OCContextTempMappingTest >> fetchArgFromOptimizedBlockInsideFullBlock: anArg ext
3333

3434
{ #category : 'tests' }
3535
OCContextTempMappingTest >> testAccessingArgOfOuterBlockFromAnotherDeepBlock [
36-
36+
<compilerOptions: #(- optionCleanBlockClosure)>
3737
| actual |
3838

3939
"Check the source code availability to do not fail on images without sources"
4040
thisContext method hasSourceCode ifFalse: [ ^ self skip ].
4141

4242
actual := [:outerArg |
4343
outerArg asString.
44-
[ :innerArg | innerArg asString. thisContext tempNamed: #outerArg ] value: #innerValue.
44+
[ :innerArg | innerArg asString.thisContext tempNamed: #outerArg ] value: #innerValue.
4545
] value: #outerValue.
4646

4747
self assert: actual equals: #outerValue

0 commit comments

Comments
 (0)