author | Claus Gittinger <cg@exept.de> |
Tue, 26 Mar 2019 18:29:44 +0100 | |
changeset 2185 | 210ba8fc2b76 |
parent 2159 | ac22dacb01ab |
permissions | -rw-r--r-- |
1447 | 1 |
"{ Package: 'stx:goodies/regression' }" |
1127 | 2 |
|
3 |
"{ NameSpace: RegressionTests }" |
|
4 |
||
5 |
TestCase subclass:#ClassAndMethodCompilingTestCase |
|
6 |
instanceVariableNames:'classes' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'tests-Regression-Abstract' |
|
10 |
! |
|
11 |
||
12 |
!ClassAndMethodCompilingTestCase class methodsFor:'documentation'! |
|
13 |
||
14 |
documentation |
|
15 |
" |
|
16 |
An abstract superclass for all tests that create classes and/or methods. |
|
17 |
Implementation of #setUp & #tearDown removes any class or method created during |
|
18 |
the test. |
|
19 |
||
20 |
[author:] |
|
1447 | 21 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
1127 | 22 |
|
23 |
[instance variables:] |
|
24 |
||
25 |
[class variables:] |
|
26 |
||
27 |
[see also:] |
|
28 |
||
29 |
" |
|
30 |
! ! |
|
31 |
||
32 |
!ClassAndMethodCompilingTestCase class methodsFor:'queries'! |
|
33 |
||
34 |
isAbstract |
|
35 |
"Return if this class is an abstract class. |
|
36 |
True is returned here for myself only; false for subclasses. |
|
37 |
Abstract subclasses must redefine again." |
|
38 |
||
39 |
^ self == RegressionTests::ClassAndMethodCompilingTestCase. |
|
40 |
! ! |
|
41 |
||
42 |
!ClassAndMethodCompilingTestCase methodsFor:'change & update'! |
|
43 |
||
44 |
update: aspect with: param from: sender |
|
45 |
aspect == #newClass ifTrue:[ |
|
1447 | 46 |
"remember the classes to be deleted on #tearDown" |
47 |
classes add: param. |
|
1127 | 48 |
]. |
49 |
||
50 |
"Created: / 20-11-2012 / 14:47:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
51 |
! ! |
|
52 |
||
2159 | 53 |
!ClassAndMethodCompilingTestCase methodsFor:'initialize / release'! |
1127 | 54 |
|
55 |
setUp |
|
56 |
Smalltalk addDependent: self. |
|
57 |
classes := Set new. |
|
58 |
||
59 |
"Created: / 20-11-2012 / 14:46:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
60 |
! |
|
61 |
||
62 |
tearDown |
|
1286
caf550ad0254
class: RegressionTests::ClassAndMethodCompilingTestCase
Stefan Vogel <sv@exept.de>
parents:
1283
diff
changeset
|
63 |
| removeBlock| |
1127 | 64 |
|
65 |
Smalltalk removeDependent: self. |
|
1286
caf550ad0254
class: RegressionTests::ClassAndMethodCompilingTestCase
Stefan Vogel <sv@exept.de>
parents:
1283
diff
changeset
|
66 |
removeBlock := [:cls| |
1447 | 67 |
| name realcls | |
1127 | 68 |
|
1447 | 69 |
name := cls name. |
70 |
(name startsWith: 'Mock') ifFalse:[ |
|
71 |
"/ Just to make sure no system class is removed, all test classes should |
|
72 |
"/ begin with 'Mock'. |
|
73 |
self breakPoint:#jv. |
|
74 |
self breakPoint:#cg. |
|
75 |
]. |
|
76 |
realcls := Smalltalk at: name. |
|
77 |
realcls notNil ifTrue:[ |
|
78 |
Smalltalk removeClass: realcls. |
|
79 |
]. |
|
1127 | 80 |
]. |
1286
caf550ad0254
class: RegressionTests::ClassAndMethodCompilingTestCase
Stefan Vogel <sv@exept.de>
parents:
1283
diff
changeset
|
81 |
classes select:[:each| each isPrivate] thenDo:removeBlock. |
caf550ad0254
class: RegressionTests::ClassAndMethodCompilingTestCase
Stefan Vogel <sv@exept.de>
parents:
1283
diff
changeset
|
82 |
classes select:[:each| each isNameSpace not and:[each isPrivate not]] thenDo:removeBlock. |
caf550ad0254
class: RegressionTests::ClassAndMethodCompilingTestCase
Stefan Vogel <sv@exept.de>
parents:
1283
diff
changeset
|
83 |
classes select:[:each| each isNameSpace] thenDo:removeBlock. |
1127 | 84 |
|
85 |
"Created: / 20-11-2012 / 14:46:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
86 |
"Modified: / 13-05-2014 / 11:13:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
87 |
! ! |
|
88 |
||
89 |
!ClassAndMethodCompilingTestCase class methodsFor:'documentation'! |
|
90 |
||
91 |
version |
|
92 |
^ '$Header$' |
|
93 |
! |
|
94 |
||
95 |
version_CVS |
|
96 |
^ '$Header$' |
|
97 |
! ! |
|
98 |