0
|
1 |
"{ Package: 'stx:goodies/ston/tests' }"
|
|
2 |
|
|
3 |
"{ NameSpace: Smalltalk }"
|
|
4 |
|
|
5 |
Dictionary subclass:#STONTestMap
|
|
6 |
instanceVariableNames:''
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'STON-Tests-Support'
|
|
10 |
!
|
|
11 |
|
|
12 |
!STONTestMap class methodsFor:'instance creation'!
|
|
13 |
|
|
14 |
classTree
|
|
15 |
^ self classTree: Object
|
|
16 |
!
|
|
17 |
|
|
18 |
classTree: topClass
|
|
19 |
| map |
|
|
20 |
map := IdentityDictionary new.
|
|
21 |
topClass withAllSubclasses do: [ :eachClass | | info |
|
|
22 |
(info := self new)
|
|
23 |
at: #name put: eachClass name asString;
|
|
24 |
at: #comment put: eachClass comment;
|
|
25 |
at: #isMeta put: eachClass isMeta;
|
|
26 |
at: #methods put: eachClass selectors.
|
|
27 |
map at: eachClass put: info ].
|
|
28 |
map keysAndValuesDo: [ :eachClass :eachInfo |
|
|
29 |
eachClass == topClass
|
|
30 |
ifFalse: [ eachInfo at: #superclass put: (map at: eachClass superclass) ].
|
|
31 |
eachInfo at: #subclasses put: (eachClass subclasses collect: [ :subClass | map at: subClass ]) ].
|
|
32 |
^ map at: topClass
|
|
33 |
!
|
|
34 |
|
|
35 |
classTreeExtended
|
|
36 |
^ self classTreeExtended: Object
|
|
37 |
!
|
|
38 |
|
|
39 |
classTreeExtended: topClass
|
|
40 |
| map |
|
|
41 |
map := IdentityDictionary new.
|
|
42 |
topClass withAllSubclasses do: [ :eachClass | | info methodsInfo |
|
|
43 |
(info := self new)
|
|
44 |
at: #name put: eachClass name asString;
|
|
45 |
at: #comment put: eachClass comment;
|
|
46 |
at: #isMeta put: eachClass isMeta;
|
|
47 |
at: #methods put: (methodsInfo := self new).
|
|
48 |
eachClass methods do: [ :eachMethod | | methodInfo |
|
|
49 |
(methodInfo := self new)
|
|
50 |
at: #name put: eachMethod selector;
|
|
51 |
at: #numArgs put: eachMethod numArgs;
|
|
52 |
at: #class put: info.
|
|
53 |
methodsInfo at: eachMethod selector put: methodInfo ].
|
|
54 |
map at: eachClass put: info ].
|
|
55 |
map keysAndValuesDo: [ :eachClass :eachInfo |
|
|
56 |
eachClass == topClass
|
|
57 |
ifFalse: [ eachInfo at: #superclass put: (map at: eachClass superclass) ].
|
|
58 |
eachInfo at: #subclasses put: (eachClass subclasses collect: [ :subClass | map at: subClass ]) ].
|
|
59 |
^ map at: topClass
|
|
60 |
! !
|
|
61 |
|
|
62 |
!STONTestMap class methodsFor:'ston-core'!
|
|
63 |
|
|
64 |
stonName
|
|
65 |
^ #TestMap
|
|
66 |
! !
|
|
67 |
|
|
68 |
!STONTestMap methodsFor:'printing'!
|
|
69 |
|
|
70 |
printElementsOn: stream
|
|
71 |
stream
|
|
72 |
nextPut: $(;
|
|
73 |
nextPut: $#;
|
|
74 |
print: self size;
|
|
75 |
nextPut: $)
|
|
76 |
! !
|
|
77 |
|