1235
|
1 |
"{ Package: 'stx:libbasic3' }"
|
|
2 |
|
|
3 |
"{ NameSpace: Packages }"
|
|
4 |
|
|
5 |
TestCase subclass:#AbstractTestCases
|
|
6 |
instanceVariableNames:''
|
|
7 |
classVariableNames:'ClearUpFiles'
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'Package-TestCases'
|
|
10 |
!
|
|
11 |
|
|
12 |
Notification subclass:#PackageTestCaseNotification
|
|
13 |
instanceVariableNames:''
|
|
14 |
classVariableNames:''
|
|
15 |
poolDictionaries:''
|
|
16 |
privateIn:AbstractTestCases
|
|
17 |
!
|
|
18 |
|
|
19 |
!AbstractTestCases class methodsFor:'documentation'!
|
|
20 |
|
|
21 |
documentation
|
|
22 |
"
|
|
23 |
documentation to be added.
|
|
24 |
|
|
25 |
[author:]
|
|
26 |
(james@miraculix)
|
|
27 |
|
|
28 |
[instance variables:]
|
|
29 |
|
|
30 |
[class variables:]
|
|
31 |
|
|
32 |
[see also:]
|
|
33 |
|
|
34 |
"
|
|
35 |
!
|
|
36 |
|
|
37 |
history
|
|
38 |
"Created: / 30.1.2003 / 10:54:54 / james"
|
|
39 |
! !
|
|
40 |
|
|
41 |
!AbstractTestCases methodsFor:'factory'!
|
|
42 |
|
|
43 |
packageTestCaseNotification
|
|
44 |
^ PackageTestCaseNotification
|
|
45 |
! !
|
|
46 |
|
|
47 |
!AbstractTestCases methodsFor:'helpers'!
|
|
48 |
|
|
49 |
aDolphinTestFilePac
|
|
50 |
^ '~/AvatarChat.pac' asFilename.
|
|
51 |
!
|
|
52 |
|
|
53 |
assertSmalltalkIncludesAllClassNames:aCollectionOfSymbols
|
|
54 |
aCollectionOfSymbols do:[:aSymbol |
|
|
55 |
self shouldnt:((Smalltalk at:aSymbol ifAbsent:[nil]) == nil).
|
|
56 |
].
|
|
57 |
!
|
|
58 |
|
|
59 |
assertSmalltalkIncludesAllLooseMethods:aCollectionOfLooseMethods
|
|
60 |
|
|
61 |
aCollectionOfLooseMethods do:[:aPackagedMethod | | class |
|
|
62 |
class := (Smalltalk at:aPackagedMethod mclass name).
|
|
63 |
self assert:(class methodDictionary keys includes:aPackagedMethod name).
|
|
64 |
].
|
|
65 |
!
|
|
66 |
|
|
67 |
createMethodFor:aClass source:aString
|
|
68 |
aClass
|
|
69 |
compile:aString
|
|
70 |
classified:'aDummyClassification'
|
|
71 |
notifying:nil.
|
|
72 |
!
|
|
73 |
|
|
74 |
createTestCaseDirectory
|
|
75 |
"create the testcase directory if i"
|
|
76 |
| testCaseDirectory |
|
|
77 |
(testCaseDirectory := self testCaseDirectory) exists ifFalse:[
|
|
78 |
testCaseDirectory makeDirectory.
|
|
79 |
].
|
|
80 |
!
|
|
81 |
|
|
82 |
createTestCaseFilenameFor:aFilenameOrString
|
|
83 |
^ self testCaseDirectory filenameFor:aFilenameOrString asFilename
|
|
84 |
!
|
|
85 |
|
|
86 |
initializePackageManager
|
|
87 |
PackageManager initialize.
|
|
88 |
!
|
|
89 |
|
|
90 |
packageManager
|
|
91 |
^ PackageManager smalltalkPackageManager
|
|
92 |
!
|
|
93 |
|
|
94 |
removeClassNamed:aSymbol
|
|
95 |
(Smalltalk at:aSymbol) ifNotNil:[
|
|
96 |
^ (Smalltalk at:aSymbol) removeFromSystem.
|
|
97 |
]
|
|
98 |
!
|
|
99 |
|
|
100 |
shouldntSmalltalkIncludesAllClassNames:aCollectionOfSymbols
|
|
101 |
aCollectionOfSymbols do:[:aSymbol |
|
|
102 |
self assert:((Smalltalk at:aSymbol ifAbsent:[nil]) == nil).
|
|
103 |
].
|
|
104 |
|
|
105 |
!
|
|
106 |
|
|
107 |
shouldntSmalltalkIncludesAllLooseMethods:aCollectionOfLooseMethods
|
|
108 |
|
|
109 |
aCollectionOfLooseMethods do:[:aMethod | | class|
|
|
110 |
class := (Smalltalk classNamed:aMethod className).
|
|
111 |
"if class is nil then the test has also passed"
|
|
112 |
class ifNotNil:[
|
|
113 |
self shouldnt:(class methodDictionary keys includes:aMethod name).
|
|
114 |
].
|
|
115 |
|
|
116 |
].
|
|
117 |
!
|
|
118 |
|
|
119 |
testCaseDirectory
|
|
120 |
^ (Filename named:'~/work/stx/testCases/')
|
|
121 |
! !
|
|
122 |
|
|
123 |
!AbstractTestCases methodsFor:'initialize / release'!
|
|
124 |
|
|
125 |
setUp
|
|
126 |
"common setup - invoked before testing"
|
|
127 |
super setUp
|
|
128 |
!
|
|
129 |
|
|
130 |
tearDown
|
|
131 |
"common cleanup - invoked after testing"
|
|
132 |
|
|
133 |
super tearDown
|
|
134 |
! !
|
|
135 |
|
|
136 |
!AbstractTestCases methodsFor:'instance creation'!
|
|
137 |
|
|
138 |
createClassNamed:aClassName
|
|
139 |
self createClassNamed:aClassName inheritsFrom:#Object
|
|
140 |
!
|
|
141 |
|
|
142 |
createClassNamed:aClassName inheritsFrom:anInheritingClassName
|
|
143 |
^ (Smalltalk at:anInheritingClassName)
|
|
144 |
subclass:aClassName
|
|
145 |
instanceVariableNames:''
|
|
146 |
classVariableNames:''
|
|
147 |
poolDictionaries:''
|
|
148 |
category:'AAAAA'
|
|
149 |
classInstanceVariableNames:''
|
|
150 |
! !
|
|
151 |
|
|
152 |
!AbstractTestCases methodsFor:'queries'!
|
|
153 |
|
|
154 |
clearUpFiles
|
|
155 |
ClearUpFiles ifNil:[
|
|
156 |
ClearUpFiles := false.
|
|
157 |
].
|
|
158 |
|
|
159 |
^ ClearUpFiles
|
|
160 |
! !
|
|
161 |
|
|
162 |
!AbstractTestCases class methodsFor:'documentation'!
|
|
163 |
|
|
164 |
version
|
|
165 |
^ '$Header: /cvs/stx/stx/libbasic3/packages/AbstractTestCases.st,v 1.1 2003-04-09 12:30:18 james Exp $'
|
|
166 |
! !
|