SimpleTestResource.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 09 Jul 2014 23:00:04 +0100
branchworking_v5_0
changeset 613 5a546630cfcf
parent 611 1eecc860f4a5
permissions -rw-r--r--
Reverted TestCase>>debug to original SUnit implementation and made TestFailure proceedable. The code in TestCase>>debug was too elaborate. The purpose was to be able to proceed to see what next assertion is failing. This could be easily achieved by making TestFailure a resumable exception (by means of #mayProceed)

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

TestResource subclass:#SimpleTestResource
	instanceVariableNames:'runningState hasRun hasSetup'
	classVariableNames:''
	poolDictionaries:''
	category:'SUnit-Tests'
!

SimpleTestResource class instanceVariableNames:'preventAvailability'

"
 The following class instance variables are inherited by this class:

	TestResource - current
	TestAsserter - 
	Object - 
"
!


!SimpleTestResource class methodsFor:'accessing'!

allowAvailability
	^preventAvailability isNil
!

rawCurrentForTest
	^current
! !

!SimpleTestResource class methodsFor:'utility'!

preventAvailabilityDuring: aBlock
	"Only setter of preventAvailability."

	preventAvailability := false.
	^aBlock ensure: [preventAvailability := nil]
! !

!SimpleTestResource methodsFor:'accessing'!

runningState

	^runningState
!

runningState: aSymbol

	runningState := aSymbol
! !

!SimpleTestResource methodsFor:'running'!

setRun
	hasRun := true
!

setUp

	self runningState: self startedStateSymbol.
	hasSetup := true
!

startedStateSymbol

	^#started
!

stoppedStateSymbol

	^#stopped
!

tearDown

	self runningState: self stoppedStateSymbol
! !

!SimpleTestResource methodsFor:'testing'!

hasRun
	^hasRun
!

hasSetup
	^hasSetup
!

isAvailable
	^self class allowAvailability and:
		[self runningState == self startedStateSymbol]
! !

!SimpleTestResource class methodsFor:'documentation'!

version_HG

    ^ '$Changeset: <not expanded> $'
!

version_SVN
    ^ '§Id: SimpleTestResource.st 214 2011-03-14 12:22:21Z vranyj1 §'
! !