-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
610 all pharo tests pass even though i didnt solve the exercise (#611)
* Handle removing of class from system, so that test can fail after removing it. - fixes #610 * Replaced deprecated method in P11. * Moved removing of class to compatibility package for P11.
- Loading branch information
Showing
4 changed files
with
31 additions
and
1 deletion.
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
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,24 @@ | ||
Extension { #name : #Class } | ||
|
||
{ #category : #'*ExercismPharo110' } | ||
Class >> removeFromSystem: logged [ | ||
"Forget the receiver from the Smalltalk global dictionary. Any existing instances will refer to an obsolete version of the receiver. | ||
Keep the class name and category for triggering the system change message. If we wait to long, then we get obsolete information which is not what we want. | ||
Tell class to deactivate and unload itself-- two separate events in the module system" | ||
| myCategory | | ||
self release. | ||
self unload. | ||
|
||
self superclass ifNotNil: | ||
["If we have no superclass there's nothing to be remembered" | ||
self superclass addObsoleteSubclass: self]. | ||
|
||
"we add the class to Undeclared so that if references still exist, they will be automatically fixed | ||
if this class is loaded again. We do not check if references exist as it is too slow" | ||
self binding value: nil. | ||
Undeclared declare: self name asSymbol from: Smalltalk globals. | ||
myCategory := self category. | ||
self environment forgetClass: self logged: logged. | ||
self obsolete. | ||
logged ifTrue: [SystemAnnouncer uniqueInstance classRemoved: self fromCategory: myCategory] | ||
] |
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 @@ | ||
Package { #name : #ExercismPharo110 } |
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