Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3584 sourcerer 1
Assertions
2
-------------------------------------------------------------------------------
3
fail
4
	assert(false);
5
 
6
assertTrue
7
assertFalse
8
	@actual is a variable name, of type boolean (or castable to boolean?)
9
	or evaluate nested condition to boolean
10
 
11
assertNull
12
assertNotNull
13
	@actual is a variable name
14
	or evaluate nested condition
15
 
16
assertEquals
17
assertNotEquals
18
	Test actual is equal (or not equal) to expected.
19
 
20
	
21
 
22
	For Collections (or Lists), need to check neither list is null, then that both lists have the same size, then that all their elements are equal.
23
 
24
	@ignoreCase="auto"
25
		if contentType == "text/html":
26
			if context == "attribute", do case insensitive test
27
			if context == "element", do case sensitive test against expected.toUpperCase()
28
	@context used in combination with ignoreCase="auto"
29
	@bitmask used in DOM Level 3 only.  Tests: (actual & bitmask) equals (expectedResult & bitmask) where bitmask is an int
30
 
31
	Alternatively, can include nested statement (presumably as a substitute to @actual), but can't see this is used anywhere.
32
 
33
assertSame
34
	Tests two objects for identity.
35
	If not, call assertEquals()
36
	Don't really understand the point of this assert
37
 
38
(note about assertNull, assertNotNull, assertEquals, assertNotEquals, assertSame)
39
	Alternatively, can include nested statement (presumably as a substitute to @actual), but can't see this is used anywhere.
40
 
41
assertInstanceOf
42
	Used in [hc_]namednodemapreturnattrnode.xml
43
	Can use Node.getNodeType() to get runtime type
44
 
45
assertSize
46
	Tests a Java Collection has the specified size.
47
 
48
	
49
 
50
assertEventCount
51
	(not used)
52
 
53
assertURIEquals
54
	Compare pieces of the URI in @actual
55
 
56
	@actual
57
	@scheme
58
	@path
59
	@host
60
	@file
61
	@name
62
	@query
63
	@fragment
64
	@isAbsolute boolean
65
 
66
assertImplementationException
67
	DOM Level 2 Events dispatchEvent01.xml
68
 
69
assertDOMException
70
	Tests that a DOMException is thrown with a specified code.  Try/catching not nested.
71
 
72
	
73
	    
74
	        
75
	    
76
	
77
 
78
	boolean success = false;
79
	try {
80
    	removedNode = attrNode.removeChild(textNode);
81
    } catch (DOMException ex) {
82
    	success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
83
    }
84
    assertTrue(success);
85
 
86
assertLowerSeverity
87
	DOM Level 3 Core only
88
 
89
Conditions
90
-------------------------------------------------------------------------------
91
same
92
	(not used)
93
 
94
equals
95
notEquals
96
less
97
 
98
lessOrEquals
99
	(not used)
100
 
101
greater
102
 
103
greaterOrEquals
104
	(not used)
105
 
106
isNull
107
	(not used)
108
 
109
notNull
110
and
111
or
112
 
113
xor
114
	(not used)
115
 
116
not
117
 
118
instanceOf
119
	(not used)
120
 
121
isTrue
122
isFalse
123
 
124
hasSize
125
	(not used)
126
 
127
contentType
128
 
129
contains
130
	DOM Level 3 Core and LS only
131
 
132
hasFeature
133
	calls DOMImplementation.hasFeature()
134
 
135
	@feature quoted string e.g. "XML"
136
	@version quoted string e.g. "1.0"
137
	@value boolean
138
	@var variable to assign the result to
139
	@obj name of var holding the DOMImplementation
140
 
141
implementationAttribute
142
	pass param to the test suite's DOMTestDocumentBuilderFactory (e.g. validating)
143
 
144
 
145
Statements
146
-------------------------------------------------------------------------------
147
var
148
	Can contain nested  elements when the var has @type Collection
149
 
150
	Can contain  element when the var type @type DOMErrorHandler.
151
	This then creates an class implementing DOMErrorHandler, overriding the handleError() method.
152
	This is only used in DOM Level 3 Core.
153
 
154
	@name variable name
155
	@type type of variable
156
	@value initially assigned value
157
	@isNull boolean assign initial value of NULL (essentially mutually exclusive with @value ?)
158
 
159
assign
160
	
161
 
162
increment
163
decrement
164
	
165
 
166
append
167
	
168
	Append an object to the end of a Collection.
169
	In Java, this is implemented with an ArrayList.
170
 
171
plus
172
subtract
173
mult
174
divide
175
load
176
 
177
if
178
while
179
 
180
try
181
	Fail if reach the end of the try without throwing an exception specified in 
182
	
183
		...
184
		
185
			
186
			
187
			...
188
		
189
	
190
 
191
	No nesting in test cases, but sometimes more than one instance in a single test.
192
 
193
for-each
194
	
195
 
196
comment
197
	Only used in DOM Level 3 XPath.
198
 
199
return
200
	Only used in DOM Level 2/3.  Returns immediately from method call with optional @value
201
 
202
userObj
203
	(not used)
204
 
205
atEvents
206
capturedEvents
207
bubbledEvents
208
allEvents
209
	DOM Level 2 Events only
210
 
211
createXPathEvaluator
212
	DOM Level 3 XPath only
213
 
214
getResourceURI
215
	DOM Level 3 LS only
216
 
217
substring
218
	
219
	Calls @obj.substringData() where obj is an instance of CharacterData
220
 
221
createTempURI
222
	DOMImplementationRegistry.newInstance
223
 
224
allErrors
225
	Only used in DOM Level 3
226
	Calls org.w3c.domts.DOMErrorMonitor.getAllErrors(), which is an instance of DOMErrorHandler
227
 
228
allNotifications
229
operation
230
key
231
dst
232
	DOM Level 3 Core only
233
 
234
Datatypes
235
-------------------------------------------------------------------------------
236
int
237
short
238
double
239
boolean
240
	Primitives
241
 
242
DOMString
243
 
244
List
245
	In Java, an ArrayList instance typed as a List
246
 
247
Collection
248
	In Java, an ArrayList instance typed as a Collection
249
 
250
	
251
		"ent1"
252
		"ent2"
253
 
254
EventMonitor
255
	DOM Level 2 Events only
256
 
257
DOMErrorMonitor
258
	DOM Level 3 only
259
 
260
UserDataMonitor
261
UserDataNotification
262
LSInputStream
263
	DOM Level 3 Core only
264
 
265
 
266
Attr
267
CDATASection
268
CharacterData
269
Comment
270
Document
271
DocumentFragment
272
DocumentType
273
DOMImplementation
274
Element
275
Entity
276
EntityReference
277
NamedNodeMap
278
Node
279
NodeList
280
Notation
281
ProcessingInstruction
282
Text
283
	DOM types
284
 
285
-------------------------------------------------------------------------------
286
WHAT ABOUT RETURN VALUES?
287
for method calls and attribute getters (&result)
288
 
289
ASSERTIONS (other statements?)
290
[temp variables for assert params]
291
assertFoo(...)
292
for @expected, produce a var decl/ref
293
required-type is the type of @actual
294
 
295
 
296
CONDITIONS IN CONTROL STRUCTURES
297
[temp variables for condition params]
298
if ()
299
for every condition clause that requires it (e.g. ), produce a var decl/ref
300
required-type is the type of @actual
301
	e.g.
302
	
303
	
304
	required-type is DOMString
305
 
306
METHOD CALL
307
[temp variables for method params]
308
[temp variable to hold method result]
309
getElementsByTagName(doc, param_a, param_b, param_c, &result)
310
[assign temp variable to real result var]
311
 
312
produce var decl/ref for each param: a, b, c
313
required-type is the method param's type in the domspec
314
 
315
 
316
ATTRIBUTE SET
317
[temp variables for setting attribute]
318
setFoo(node, param)
319
 
320
required-type is the attribute's type in the domspec
321
 
322
 
323
ATTRIBUTE GET
324
[temp variable to hold getter result]
325
getFoo(node, &result)
326
[assign temp variable to real result var]
327
 
328
call produce-var-reference in getFoo() call to generate &result
329
call produce-var-assignment after getFoo() to convert the temp result into the desired result
330
 
331
 
332
PSEUDO TEMPLATES
333
template name="produce-var-declaration"
334
param name="var-or-literal"
335
param name="required-type"
336
if (needs temp variable)
337
	declare and assign new temporary variable $var_x$
338
/if
339
 
340
template name="produce-var-reference"
341
choose
342
	when (needs temp variable)
343
		print temporary variable $var_x$ using generate-id()
344
	when (needs cast)
345
		call-template name="cast"
346
	otherwise
347
		$var-or-literal
348
/choose
349
 
350
template name="produce-var-assignment"
351
if (needs temp variable)
352
	$var-or-literal = conversion_function($var_x$);
353
/if