Skip to content

Commit

Permalink
Merge pull request #13859 from MarcusDenker/fix-ivars-BlockClosureTest
Browse files Browse the repository at this point in the history
fix variable names in BlockClosureTest
  • Loading branch information
MarcusDenker committed May 30, 2023
2 parents 428d6a4 + 1cef470 commit e4153a5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/Kernel-Tests-Extended/BlockClosureTest.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ BlockClosureTest >> testCannotReturn [

{ #category : #'*Kernel-Tests-Extended' }
BlockClosureTest >> testRunSimulated [
self assert: (Context runSimulated: aBlockContext) class equals: Rectangle
self assert: (Context runSimulated: aBlock) class equals: Rectangle
]

{ #category : #'*Kernel-Tests-Extended' }
Expand All @@ -54,11 +54,11 @@ BlockClosureTest >> testTallyInstructions [
ifTrue: [ 26 ]
ifFalse: [ 27 ].
self
assert: (Context tallyInstructions: aBlockContext) size
assert: (Context tallyInstructions: aBlock) size
equals: expected
]

{ #category : #'*Kernel-Tests-Extended' }
BlockClosureTest >> testTallyMethods [
self assert: (Context tallyMethods: aBlockContext) size equals: 7
self assert: (Context tallyMethods: aBlock) size equals: 7
]
24 changes: 12 additions & 12 deletions src/Kernel-Tests/BlockClosureTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Class {
#name : #BlockClosureTest,
#superclass : #TestCase,
#instVars : [
'aBlockContext',
'contextOfaBlockContext'
'aBlock',
'contextOfaBlock'
],
#category : #'Kernel-Tests-Methods'
}
Expand All @@ -21,8 +21,8 @@ BlockClosureTest >> blockWithNonLocalReturn: resultObject [
BlockClosureTest >> setUp [
super setUp.
"we reference self to force a full block"
aBlockContext := [self . 100@100 corner: 200@200].
contextOfaBlockContext := thisContext
aBlock := [self . 100@100 corner: 200@200].
contextOfaBlock := thisContext
]

{ #category : #'tests - evaluating' }
Expand Down Expand Up @@ -187,7 +187,7 @@ BlockClosureTest >> testIsClean [
self deny: [^nil] isClean. "closes over home (^-return)"
self deny: [self] isClean. "closes over the receiver"
self deny: [super testIsClean] isClean. "closes over the receiver"
self deny: [contextOfaBlockContext] isClean. "closes over the receiver (to access the inst var contextOfaBlockContext)"
self deny: [contextOfaBlock] isClean. "closes over the receiver (to access the inst var contextOfaBlockContext)"
self deny: [local] isClean. "closes over local variable of outer context"
]

Expand Down Expand Up @@ -373,10 +373,10 @@ BlockClosureTest >> testPrintOnBlockDefinedInMethodWithoutSourceCode [
BlockClosureTest >> testSetUp [
"Note: In addition to verifying that the setUp worked the way it was expected to, testSetUp is used to illustrate the meaning of the simple access methods, methods that are not normally otherwise 'tested'"

self assert: aBlockContext home equals: contextOfaBlockContext.
self assert: aBlockContext receiver equals: self.
self assert: aBlock home equals: contextOfaBlock.
self assert: aBlock receiver equals: self.
"Depending on the closure implementation, it's either a compiled block, a compiled method or nil."
self assert: (aBlockContext method isNil or: [ aBlockContext method isKindOf: CompiledCode ])
self assert: (aBlock method isNil or: [ aBlock method isKindOf: CompiledCode ])
]

{ #category : #tests }
Expand Down Expand Up @@ -473,9 +473,9 @@ BlockClosureTest >> testSuppressInformUsingStringMatchOptions [
{ #category : #'tests - evaluating' }
BlockClosureTest >> testValueWithArguments [

self shouldnt: [ aBlockContext valueWithArguments: #() ] raise: ArgumentsCountMismatch.
self shouldnt: [ aBlock valueWithArguments: #() ] raise: ArgumentsCountMismatch.

self should: [ aBlockContext valueWithArguments: #(1) ] raise: ArgumentsCountMismatch
self should: [ aBlock valueWithArguments: #(1) ] raise: ArgumentsCountMismatch
withExceptionDo: [ :err |
self assert: err expectedArgumentsCount equals: 0.
self assert: err calledArgumentsCount equals: 1 ].
Expand All @@ -490,11 +490,11 @@ BlockClosureTest >> testValueWithArguments [
BlockClosureTest >> testValueWithArgumentsWithOrderedCollection [

self
shouldnt: [ aBlockContext valueWithArguments: #() asOrderedCollection ]
shouldnt: [ aBlock valueWithArguments: #() asOrderedCollection ]
raise: ArgumentsCountMismatch.

self
should: [ aBlockContext valueWithArguments: #(1) asOrderedCollection ]
should: [ aBlock valueWithArguments: #(1) asOrderedCollection ]
raise: ArgumentsCountMismatch
withExceptionDo: [ :err |
self assert: err expectedArgumentsCount equals: 0.
Expand Down

0 comments on commit e4153a5

Please sign in to comment.