author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sat, 03 Sep 2016 09:08:25 +0100 | |
branch | jv |
changeset 664 | e31b2e7b658d |
parent 222 | 8e6f482297fa |
child 724 | 4dae63fce9f9 |
permissions | -rw-r--r-- |
222 | 1 |
"{ Package: 'stx:goodies/sunit' }" |
2 |
||
664
e31b2e7b658d
FIX: Do not treat skipped test as passed!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
222
diff
changeset
|
3 |
"{ NameSpace: Smalltalk }" |
e31b2e7b658d
FIX: Do not treat skipped test as passed!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
222
diff
changeset
|
4 |
|
222 | 5 |
TestResource subclass:#SimpleTestResource |
6 |
instanceVariableNames:'runningState hasRun hasSetup' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'SUnit-Tests' |
|
10 |
! |
|
11 |
||
12 |
SimpleTestResource class instanceVariableNames:'preventAvailability' |
|
13 |
||
14 |
" |
|
15 |
The following class instance variables are inherited by this class: |
|
16 |
||
17 |
TestResource - current |
|
664
e31b2e7b658d
FIX: Do not treat skipped test as passed!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
222
diff
changeset
|
18 |
TestAsserter - |
e31b2e7b658d
FIX: Do not treat skipped test as passed!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
222
diff
changeset
|
19 |
Object - |
222 | 20 |
" |
21 |
! |
|
22 |
||
23 |
||
24 |
!SimpleTestResource class methodsFor:'accessing'! |
|
25 |
||
26 |
allowAvailability |
|
27 |
^preventAvailability isNil |
|
28 |
! |
|
29 |
||
30 |
rawCurrentForTest |
|
31 |
^current |
|
32 |
! ! |
|
33 |
||
34 |
!SimpleTestResource class methodsFor:'utility'! |
|
35 |
||
36 |
preventAvailabilityDuring: aBlock |
|
37 |
"Only setter of preventAvailability." |
|
38 |
||
39 |
preventAvailability := false. |
|
40 |
^aBlock ensure: [preventAvailability := nil] |
|
41 |
! ! |
|
42 |
||
43 |
!SimpleTestResource methodsFor:'accessing'! |
|
44 |
||
45 |
runningState |
|
46 |
||
47 |
^runningState |
|
48 |
! |
|
49 |
||
50 |
runningState: aSymbol |
|
51 |
||
52 |
runningState := aSymbol |
|
53 |
! ! |
|
54 |
||
55 |
!SimpleTestResource methodsFor:'running'! |
|
56 |
||
57 |
setRun |
|
58 |
hasRun := true |
|
59 |
! |
|
60 |
||
61 |
setUp |
|
62 |
||
63 |
self runningState: self startedStateSymbol. |
|
64 |
hasSetup := true |
|
65 |
! |
|
66 |
||
67 |
startedStateSymbol |
|
68 |
||
69 |
^#started |
|
70 |
! |
|
71 |
||
72 |
stoppedStateSymbol |
|
73 |
||
74 |
^#stopped |
|
75 |
! |
|
76 |
||
77 |
tearDown |
|
78 |
||
79 |
self runningState: self stoppedStateSymbol |
|
80 |
! ! |
|
81 |
||
82 |
!SimpleTestResource methodsFor:'testing'! |
|
83 |
||
84 |
hasRun |
|
85 |
^hasRun |
|
86 |
! |
|
87 |
||
88 |
hasSetup |
|
89 |
^hasSetup |
|
90 |
! |
|
91 |
||
92 |
isAvailable |
|
93 |
^self class allowAvailability and: |
|
94 |
[self runningState == self startedStateSymbol] |
|
95 |
! ! |
|
96 |
||
97 |
!SimpleTestResource class methodsFor:'documentation'! |
|
98 |
||
99 |
version_SVN |
|
100 |
^ '§Id: SimpleTestResource.st 214 2011-03-14 12:22:21Z vranyj1 §' |
|
101 |
! ! |
|
664
e31b2e7b658d
FIX: Do not treat skipped test as passed!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
222
diff
changeset
|
102 |