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