-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
118 additions
and
72 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
src/MethodProxies-Tests/MpAbstractMethodProxyTest.class.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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
Class { | ||
#name : #MpAbstractMethodProxyTest, | ||
#superclass : #TestCase, | ||
#instVars : [ | ||
'trackedWrappers' | ||
], | ||
#category : #'MethodProxies-Tests' | ||
} | ||
|
||
{ #category : #testing } | ||
MpAbstractMethodProxyTest class >> isAbstract [ | ||
|
||
^ self == MpAbstractMethodProxyTest | ||
] | ||
|
||
{ #category : #'tests - dead representation' } | ||
MpAbstractMethodProxyTest >> installMethodProxy: aMethodProxy [ | ||
|
||
trackedWrappers add: aMethodProxy. | ||
aMethodProxy install. | ||
|
||
] | ||
|
||
{ #category : #initialization } | ||
MpAbstractMethodProxyTest >> setUp [ | ||
|
||
super setUp. | ||
trackedWrappers := OrderedCollection new | ||
] | ||
|
||
{ #category : #initialization } | ||
MpAbstractMethodProxyTest >> tearDown [ | ||
|
||
| stillInstalled | | ||
|
||
"Uninstall proxies using a fixed point approach. | ||
This is to cover a problem of proxies wrapping proxies for now" | ||
[ | ||
stillInstalled := trackedWrappers select: [ :e | e isInstalled ]. | ||
stillInstalled isEmpty ] whileFalse: [ | ||
stillInstalled do: [ :each | | ||
[ | ||
each uninstall. | ||
trackedWrappers remove: each ] | ||
on: Error | ||
do: [ :e | "continue" ] ] ]. | ||
|
||
"Give me the guarantee that we did not leave proxies installed in the system" | ||
(MpMethodProxy allInstances anySatisfy: [ :e | e isInstalled ]) | ||
ifTrue: [ | ||
self error: | ||
'Proxies still installed after test: ' , testSelector asString ]. | ||
|
||
super tearDown | ||
] |
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
2 changes: 1 addition & 1 deletion
2
src/MethodProxiesExamples-Tests/MpAllocationProfilerHandlerTest.class.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
5 changes: 0 additions & 5 deletions
5
src/MethodProxiesExamples-Tests/MpCalledMethodProxyTest.class.st
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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