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