SUnitNameResolver.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 14 Jul 2014 21:58:21 +0100
branchworking_v5_0
changeset 614 3003097506c9
parent 222 8e6f482297fa
permissions -rw-r--r--
Refactored remembering of TestCaseOutcomes. TestCaseOutcomes are no longer remembered in class instance var of the TestCase but rather in one global dictionary on TestCaseOutcome class. The top-level weak dictionary uses test method as a key and second-level dictionary as value. This ensures that when a test method is changed, sooner or later (now obsolete) remebered outcomes are reclamed by the GC. The second-level dictionary uses test case class as a key and outcome as value. This is used to keep outcomes for inherited test cases. This dictionary is also weak, ensuring that when the class is unloaded or changed, outcomes are reclamed. To reduce a number of weak objects a special TestCaseOutcomeWeakIdentityDictionary is used. It optimizes the most common case when there are no inherited testcases.

"{ Package: 'stx:goodies/sunit' }"

Object subclass:#SUnitNameResolver
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'SUnit-Preload'
!


!SUnitNameResolver class methodsFor:'Camp Smalltalk'!

classNamed: aSymbol
    ^Smalltalk at: aSymbol ifAbsent: [nil]
!

defaultLogDevice
    ^Transcript
!

errorObject

    ^Exception
"/  ^Error

    "Modified: / 11-09-2010 / 15:10:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

mnuExceptionObject
	^MessageNotUnderstood
!

notificationObject
	^Notification
!

weakIdentityDictionaryClass
    "Return an EphemeronDictionary (if available) or Weak(Identity)Dictionary class"
    
    #(
     #EphemeronDictionary       "VW"
     #WeakIdentityDictionary    "St/X"
     #WeakDictionary            "VW"
     )
            do:[:name | 
                | class |

                class := self classNamed:name.
                class notNil ifTrue:[
                    ^ class.
                ].
            ].
    self error:'No weak-like dictionary class found!!'.

    "Created: / 14-07-2014 / 09:46:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (format): / 14-07-2014 / 21:01:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!SUnitNameResolver class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/goodies/sunit/SUnitNameResolver.st,v 1.7 2011-06-29 19:15:49 cg Exp $'
!

version_SVN
    ^ '§Id: SUnitNameResolver.st 204 2010-09-11 15:21:51Z vranyj1 §'
! !