222
|
1 |
"{ Package: 'stx:goodies/sunit' }"
|
|
2 |
|
|
3 |
TestResource subclass:#SimpleTestResource
|
|
4 |
instanceVariableNames:'runningState hasRun hasSetup'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'SUnit-Tests'
|
|
8 |
!
|
|
9 |
|
|
10 |
SimpleTestResource class instanceVariableNames:'preventAvailability'
|
|
11 |
|
|
12 |
"
|
|
13 |
The following class instance variables are inherited by this class:
|
|
14 |
|
|
15 |
TestResource - current
|
|
16 |
TestAsserter -
|
|
17 |
Object -
|
|
18 |
"
|
|
19 |
!
|
|
20 |
|
|
21 |
|
|
22 |
!SimpleTestResource class methodsFor:'accessing'!
|
|
23 |
|
|
24 |
allowAvailability
|
|
25 |
^preventAvailability isNil
|
|
26 |
!
|
|
27 |
|
|
28 |
rawCurrentForTest
|
|
29 |
^current
|
|
30 |
! !
|
|
31 |
|
|
32 |
!SimpleTestResource class methodsFor:'utility'!
|
|
33 |
|
|
34 |
preventAvailabilityDuring: aBlock
|
|
35 |
"Only setter of preventAvailability."
|
|
36 |
|
|
37 |
preventAvailability := false.
|
|
38 |
^aBlock ensure: [preventAvailability := nil]
|
|
39 |
! !
|
|
40 |
|
|
41 |
!SimpleTestResource methodsFor:'accessing'!
|
|
42 |
|
|
43 |
runningState
|
|
44 |
|
|
45 |
^runningState
|
|
46 |
!
|
|
47 |
|
|
48 |
runningState: aSymbol
|
|
49 |
|
|
50 |
runningState := aSymbol
|
|
51 |
! !
|
|
52 |
|
|
53 |
!SimpleTestResource methodsFor:'running'!
|
|
54 |
|
|
55 |
setRun
|
|
56 |
hasRun := true
|
|
57 |
!
|
|
58 |
|
|
59 |
setUp
|
|
60 |
|
|
61 |
self runningState: self startedStateSymbol.
|
|
62 |
hasSetup := true
|
|
63 |
!
|
|
64 |
|
|
65 |
startedStateSymbol
|
|
66 |
|
|
67 |
^#started
|
|
68 |
!
|
|
69 |
|
|
70 |
stoppedStateSymbol
|
|
71 |
|
|
72 |
^#stopped
|
|
73 |
!
|
|
74 |
|
|
75 |
tearDown
|
|
76 |
|
|
77 |
self runningState: self stoppedStateSymbol
|
|
78 |
! !
|
|
79 |
|
|
80 |
!SimpleTestResource methodsFor:'testing'!
|
|
81 |
|
|
82 |
hasRun
|
|
83 |
^hasRun
|
|
84 |
!
|
|
85 |
|
|
86 |
hasSetup
|
|
87 |
^hasSetup
|
|
88 |
!
|
|
89 |
|
|
90 |
isAvailable
|
|
91 |
^self class allowAvailability and:
|
|
92 |
[self runningState == self startedStateSymbol]
|
|
93 |
! !
|
|
94 |
|
|
95 |
!SimpleTestResource class methodsFor:'documentation'!
|
|
96 |
|
|
97 |
version_SVN
|
|
98 |
^ '§Id: SimpleTestResource.st 214 2011-03-14 12:22:21Z vranyj1 §'
|
|
99 |
! !
|