|
0
|
1 |
<html> |
|
|
2 |
<head> |
|
|
3 |
<title>profiler tests</title> |
|
|
4 |
<link type="text/css" rel="stylesheet" href="../../../build/logreader/assets/skins/sam/logreader.css" /> |
|
|
5 |
<script type="text/javascript" src="../../../build/yui/yui.js"></script> |
|
|
6 |
</head> |
|
|
7 |
<body class="yui-skin-sam"> |
|
|
8 |
<h1>Profiler Tests</h1> |
|
|
9 |
<div id="c"></div> |
|
|
10 |
<script type="text/javascript"> |
|
|
11 |
|
|
|
12 |
//global function |
|
|
13 |
function getMessage(){ |
|
|
14 |
return "hi"; |
|
|
15 |
} |
|
|
16 |
|
|
|
17 |
//global object |
|
|
18 |
var myObject = { |
|
|
19 |
getName : function(){ |
|
|
20 |
return "myObject"; |
|
|
21 |
} |
|
|
22 |
}; |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
YUI({ |
|
|
26 |
base: '../../../build/', |
|
|
27 |
filter: "debug", |
|
|
28 |
logInclude: { TestRunner: true } |
|
|
29 |
}).use('test', 'console', 'profiler', function (Y) { |
|
|
30 |
|
|
|
31 |
Y.namespace("Tests"); |
|
|
32 |
|
|
|
33 |
|
|
|
34 |
Y.Tests.Profiler = (function(){ |
|
|
35 |
|
|
|
36 |
var Assert = Y.Assert; |
|
|
37 |
var Profiler = Y.Profiler; |
|
|
38 |
|
|
|
39 |
//------------------------------------------------------------------------- |
|
|
40 |
// Information needed to run tests |
|
|
41 |
//------------------------------------------------------------------------- |
|
|
42 |
|
|
|
43 |
var testObject = { |
|
|
44 |
|
|
|
45 |
factorial : function (num){ |
|
|
46 |
if (num > 1) { |
|
|
47 |
return num * testObject.factorial(num-1); |
|
|
48 |
} else { |
|
|
49 |
return 1; |
|
|
50 |
} |
|
|
51 |
}, |
|
|
52 |
|
|
|
53 |
add : function (iterations){ |
|
|
54 |
var sum = 0; |
|
|
55 |
for (var i=0; i < iterations; i++){ |
|
|
56 |
sum++; |
|
|
57 |
} |
|
|
58 |
} |
|
|
59 |
}; |
|
|
60 |
|
|
|
61 |
var root = {}; |
|
|
62 |
root.SuperType = function(){ |
|
|
63 |
this.name = "SuperType"; |
|
|
64 |
} |
|
|
65 |
|
|
|
66 |
root.SuperType.prototype.getName = function(){ |
|
|
67 |
return this.name; |
|
|
68 |
}; |
|
|
69 |
|
|
|
70 |
root.SubType = function(){ |
|
|
71 |
this.age = 29; |
|
|
72 |
root.SubType.superclass.constructor.call(this); |
|
|
73 |
} |
|
|
74 |
|
|
|
75 |
Y.extend(root.SubType, root.SuperType, { |
|
|
76 |
getAge : function (){ |
|
|
77 |
return this.age; |
|
|
78 |
} |
|
|
79 |
}); |
|
|
80 |
|
|
|
81 |
|
|
|
82 |
//------------------------------------------------------------------------- |
|
|
83 |
// Base Test Suite |
|
|
84 |
//------------------------------------------------------------------------- |
|
|
85 |
|
|
|
86 |
var suite = new Y.Test.Suite("Profiler Tests"); |
|
|
87 |
|
|
|
88 |
//------------------------------------------------------------------------- |
|
|
89 |
// Test Case for basic function profiling |
|
|
90 |
//------------------------------------------------------------------------- |
|
|
91 |
|
|
|
92 |
suite.add(new Y.Test.Case({ |
|
|
93 |
|
|
|
94 |
name : "Profiler Registration Tests", |
|
|
95 |
|
|
|
96 |
tearDown: function(){ |
|
|
97 |
Profiler.clear(); |
|
|
98 |
}, |
|
|
99 |
|
|
|
100 |
//--------------------------------------------------------------------- |
|
|
101 |
// Special assertions for profiler |
|
|
102 |
//--------------------------------------------------------------------- |
|
|
103 |
|
|
|
104 |
assertFunctionIsRegistered : function (fullFuncName, shortFuncName, owner, originalFunction, newFunction){ |
|
|
105 |
var containerFunc = Profiler.getOriginal(fullFuncName); |
|
|
106 |
Assert.areNotEqual(originalFunction, newFunction, fullFuncName + " function was not replaced."); |
|
|
107 |
Assert.areEqual(originalFunction, containerFunc, "Original " + fullFuncName + " function was not stored."); |
|
|
108 |
Assert.areEqual(originalFunction.prototype, containerFunc.prototype, fullFuncName + " prototype was not copied."); |
|
|
109 |
Assert.areEqual(shortFuncName, containerFunc.__yuiFuncName, fullFuncName + " function name was not stored."); |
|
|
110 |
Assert.areEqual(owner, containerFunc.__yuiOwner, "Owner for " + fullFuncName + "was not stored."); |
|
|
111 |
Assert.isObject(Profiler.getReport(fullFuncName), "Report for " + fullFuncName + " function was not created."); |
|
|
112 |
|
|
|
113 |
}, |
|
|
114 |
|
|
|
115 |
assertFunctionIsNotRegistered : function(fullFuncName, shortFuncName, owner, originalFunction, newFunction){ |
|
|
116 |
Assert.areEqual(originalFunction, newFunction, "Original " + fullFuncName + " function was not placed back on owner."); |
|
|
117 |
Assert.isUndefined(Profiler.getOriginal(fullFuncName), "Container for original " + fullFuncName + " function was not destroyed."); |
|
|
118 |
}, |
|
|
119 |
|
|
|
120 |
//--------------------------------------------------------------------- |
|
|
121 |
// Tests |
|
|
122 |
//--------------------------------------------------------------------- |
|
|
123 |
|
|
|
124 |
testInstrument: function(){ |
|
|
125 |
var original = function() { return "Hello"; }; |
|
|
126 |
var instrumented = Profiler.instrument("hello", original); |
|
|
127 |
|
|
|
128 |
this.assertFunctionIsRegistered("hello", "hello", null, original, instrumented); |
|
|
129 |
|
|
|
130 |
|
|
|
131 |
}, |
|
|
132 |
|
|
|
133 |
testRegisterFunction : function (){ |
|
|
134 |
|
|
|
135 |
var originalFunction = testObject.factorial; |
|
|
136 |
var fullFuncName = "testObject.factorial"; |
|
|
137 |
|
|
|
138 |
Profiler.registerFunction(fullFuncName, testObject); |
|
|
139 |
|
|
|
140 |
this.assertFunctionIsRegistered(fullFuncName, "factorial", testObject, originalFunction, testObject.factorial); |
|
|
141 |
|
|
|
142 |
Profiler.unregisterFunction(fullFuncName); |
|
|
143 |
|
|
|
144 |
this.assertFunctionIsNotRegistered(fullFuncName, "factorial", testObject, originalFunction, testObject.factorial); |
|
|
145 |
|
|
|
146 |
}, |
|
|
147 |
|
|
|
148 |
testRegisterGlobalFunction : function (){ |
|
|
149 |
|
|
|
150 |
var originalFunction = getMessage; |
|
|
151 |
var fullFuncName = "getMessage"; |
|
|
152 |
|
|
|
153 |
Profiler.registerFunction(fullFuncName, window); |
|
|
154 |
|
|
|
155 |
this.assertFunctionIsRegistered(fullFuncName, "getMessage", window, originalFunction, getMessage); |
|
|
156 |
|
|
|
157 |
Profiler.unregisterFunction(fullFuncName); |
|
|
158 |
|
|
|
159 |
this.assertFunctionIsNotRegistered(fullFuncName, "getMessage", window, originalFunction, getMessage); |
|
|
160 |
|
|
|
161 |
}, |
|
|
162 |
|
|
|
163 |
testRegisterGlobalFunctionOnGlobalObject : function (){ |
|
|
164 |
|
|
|
165 |
var originalFunction = myObject.getName; |
|
|
166 |
var fullFuncName = "myObject.getName"; |
|
|
167 |
|
|
|
168 |
Profiler.registerFunction(fullFuncName); |
|
|
169 |
|
|
|
170 |
this.assertFunctionIsRegistered(fullFuncName, "getName", myObject, originalFunction, myObject.getName); |
|
|
171 |
|
|
|
172 |
Profiler.unregisterFunction(fullFuncName); |
|
|
173 |
|
|
|
174 |
this.assertFunctionIsNotRegistered(fullFuncName, "getName", myObject, originalFunction, myObject.getName); |
|
|
175 |
|
|
|
176 |
}, |
|
|
177 |
|
|
|
178 |
testRegisterObject : function (){ |
|
|
179 |
|
|
|
180 |
var funcNames = []; |
|
|
181 |
var originalFuncs = {}; |
|
|
182 |
|
|
|
183 |
//get all methods |
|
|
184 |
for (var propName in testObject){ |
|
|
185 |
if (typeof propName == "function"){ |
|
|
186 |
funcNames.push(propName); |
|
|
187 |
originalFuncs[propName] = testObject[propName]; |
|
|
188 |
} |
|
|
189 |
} |
|
|
190 |
|
|
|
191 |
Profiler.registerObject("testObject", testObject); |
|
|
192 |
|
|
|
193 |
Assert.isObject(Profiler.getOriginal("testObject"), "Object was not added to container."); |
|
|
194 |
|
|
|
195 |
//check each method |
|
|
196 |
for (var i=0; i < funcNames.length; i++){ |
|
|
197 |
var fullFuncName = "testobject." + funcNames[i]; |
|
|
198 |
var originalFunction = originalFuncs[funcNames[i]]; |
|
|
199 |
this.assertFunctionIsRegistered(fullFuncName, funcNames[i], testObject, originalFunction, testObject[funcNames[i]]); |
|
|
200 |
} |
|
|
201 |
|
|
|
202 |
Profiler.unregisterObject("testObject"); |
|
|
203 |
|
|
|
204 |
//check each method |
|
|
205 |
for (var i=0; i < funcNames.length; i++){ |
|
|
206 |
var fullFuncName = "testobject." + funcNames[i]; |
|
|
207 |
var originalFunction = originalFuncs[funcNames[i]]; |
|
|
208 |
this.assertFunctionIsNotRegistered(fullFuncName, funcNames[i], testObject, originalFunction, testObject[funcNames[i]]); |
|
|
209 |
} |
|
|
210 |
|
|
|
211 |
Assert.isUndefined(Profiler.getOriginal("testObject"), "Object was not removed from container."); |
|
|
212 |
|
|
|
213 |
}, |
|
|
214 |
|
|
|
215 |
testRegisterConstructor : function (){ |
|
|
216 |
|
|
|
217 |
var originalConstructor = root.SuperType; |
|
|
218 |
|
|
|
219 |
//gather stuff on the prototype |
|
|
220 |
var funcNames = []; |
|
|
221 |
var originalFuncs = {}; |
|
|
222 |
|
|
|
223 |
for (var prop in root.SuperType.prototype){ |
|
|
224 |
if (Y.Lang.isFunction(root.SuperType.prototype)){ |
|
|
225 |
funcNames.push(prop); |
|
|
226 |
originalFuncs[prop] = root.SuperType.prototype[prop]; |
|
|
227 |
} |
|
|
228 |
|
|
|
229 |
} |
|
|
230 |
|
|
|
231 |
Profiler.registerConstructor("root.SuperType", root); |
|
|
232 |
this.assertFunctionIsRegistered("root.SuperType", "SuperType", root, originalConstructor, root.SuperType); |
|
|
233 |
|
|
|
234 |
//check each method |
|
|
235 |
for (var i=0; i < funcNames.length; i++){ |
|
|
236 |
var fullFuncName = "root.SuperType.prototype." + funcNames[i]; |
|
|
237 |
var originalFunction = originalFuncs[funcNames[i]]; |
|
|
238 |
this.assertFunctionIsRegistered(fullFuncName, funcNames[i], root.SuperType.prototype, originalFunction, root.SuperType.prototype[funcNames[i]]); |
|
|
239 |
} |
|
|
240 |
|
|
|
241 |
Profiler.unregisterConstructor("root.SuperType"); |
|
|
242 |
|
|
|
243 |
//check each method |
|
|
244 |
for (var i=0; i < funcNames.length; i++){ |
|
|
245 |
var fullFuncName = "root.SuperType.prototype." + funcNames[i]; |
|
|
246 |
var originalFunction = originalFuncs[funcNames[i]]; |
|
|
247 |
this.assertFunctionIsNotRegistered(fullFuncName, funcNames[i], root.SuperType.prototype, originalFunction, root.SuperType.prototype[funcNames[i]]); |
|
|
248 |
} |
|
|
249 |
|
|
|
250 |
this.assertFunctionIsNotRegistered("root.SuperType", "SuperType", root, originalConstructor, root.SuperType); |
|
|
251 |
}, |
|
|
252 |
|
|
|
253 |
testRegisterConstructorWithInheritance : function (){ |
|
|
254 |
|
|
|
255 |
var originalConstructor = root.SubType; |
|
|
256 |
|
|
|
257 |
//gather stuff on the prototype |
|
|
258 |
var funcNames = []; |
|
|
259 |
var originalFuncs = {}; |
|
|
260 |
|
|
|
261 |
for (var prop in root.SubType.prototype){ |
|
|
262 |
if (Y.Lang.isFunction(root.SubType.prototype)){ |
|
|
263 |
funcNames.push(prop); |
|
|
264 |
originalFuncs[prop] = root.SubType.prototype[prop]; |
|
|
265 |
} |
|
|
266 |
|
|
|
267 |
} |
|
|
268 |
|
|
|
269 |
Profiler.registerConstructor("root.SubType", root); |
|
|
270 |
this.assertFunctionIsRegistered("root.SubType", "SubType", root, originalConstructor, root.SubType); |
|
|
271 |
|
|
|
272 |
//check the superclass property |
|
|
273 |
Assert.isObject(root.SubType.superclass, "SubType superclass should be an object."); |
|
|
274 |
Assert.areEqual(root.SuperType, root.SubType.superclass.constructor, "SubType superclass constructor should be SuperType."); |
|
|
275 |
|
|
|
276 |
//check each method |
|
|
277 |
for (var i=0; i < funcNames.length; i++){ |
|
|
278 |
var fullFuncName = "root.SubType.prototype." + funcNames[i]; |
|
|
279 |
var originalFunction = originalFuncs[funcNames[i]]; |
|
|
280 |
this.assertFunctionIsRegistered(fullFuncName, funcNames[i], root.SubType.prototype, originalFunction, root.SubType.prototype[funcNames[i]]); |
|
|
281 |
} |
|
|
282 |
|
|
|
283 |
Profiler.unregisterConstructor("root.SubType"); |
|
|
284 |
|
|
|
285 |
//check each method |
|
|
286 |
for (var i=0; i < funcNames.length; i++){ |
|
|
287 |
var fullFuncName = "root.SubType.prototype." + funcNames[i]; |
|
|
288 |
var originalFunction = originalFuncs[funcNames[i]]; |
|
|
289 |
this.assertFunctionIsNotRegistered(fullFuncName, funcNames[i], root.SubType.prototype, originalFunction, root.SubType.prototype[funcNames[i]]); |
|
|
290 |
} |
|
|
291 |
|
|
|
292 |
this.assertFunctionIsNotRegistered("root.SubType", "SubType", root, originalConstructor, root.SubType); |
|
|
293 |
}, |
|
|
294 |
|
|
|
295 |
testFunctionAccuracy1 : function (){ |
|
|
296 |
|
|
|
297 |
Profiler.registerFunction("testObject.factorial", testObject); |
|
|
298 |
|
|
|
299 |
var result = testObject.factorial(10); |
|
|
300 |
|
|
|
301 |
Profiler.unregisterFunction("testObject.factorial"); |
|
|
302 |
|
|
|
303 |
Assert.areEqual(3628800, result, "Factorial result was incorrect."); |
|
|
304 |
|
|
|
305 |
|
|
|
306 |
}, |
|
|
307 |
|
|
|
308 |
testFunctionAccuracy2 : function (){ |
|
|
309 |
|
|
|
310 |
Profiler.registerConstructor("root.SubType", root); |
|
|
311 |
|
|
|
312 |
var o = new root.SubType(); |
|
|
313 |
var age = o.getAge(); |
|
|
314 |
var name = o.getName(); |
|
|
315 |
|
|
|
316 |
Assert.areEqual(29, age, "o.age was incorrect."); |
|
|
317 |
Assert.areEqual("SuperType", name, "o.name was incorrect"); |
|
|
318 |
|
|
|
319 |
var o2 = new root.SubType(); |
|
|
320 |
age = o2.getAge(); |
|
|
321 |
name = o2.getName(); |
|
|
322 |
|
|
|
323 |
Assert.areEqual(29, age, "o2.Age was incorrect."); |
|
|
324 |
Assert.areEqual("SuperType", name, "o2.Name was incorrect"); |
|
|
325 |
|
|
|
326 |
Profiler.unregisterConstructor("root.SubType"); |
|
|
327 |
|
|
|
328 |
|
|
|
329 |
} |
|
|
330 |
})); |
|
|
331 |
|
|
|
332 |
//------------------------------------------------------------------------- |
|
|
333 |
// Test Case for stopwatch functions |
|
|
334 |
//------------------------------------------------------------------------- |
|
|
335 |
|
|
|
336 |
suite.add(new Y.Test.Case({ |
|
|
337 |
|
|
|
338 |
name : "Profiler Stopwatch Tests", |
|
|
339 |
|
|
|
340 |
|
|
|
341 |
tearDown: function(){ |
|
|
342 |
Profiler.clear(); |
|
|
343 |
}, |
|
|
344 |
|
|
|
345 |
testStartStop: function (){ |
|
|
346 |
|
|
|
347 |
Profiler.start("random.entry"); |
|
|
348 |
|
|
|
349 |
for (var i=0; i < 10000; i++){} |
|
|
350 |
|
|
|
351 |
Profiler.stop("random.entry"); |
|
|
352 |
|
|
|
353 |
var report = Profiler.getReport("random.entry"); |
|
|
354 |
|
|
|
355 |
Assert.isObject(report, "Report should be an object."); |
|
|
356 |
Assert.areEqual(1, report.calls, "Call count should be 1."); |
|
|
357 |
Assert.isNumber(report.max, "Max should be a number."); |
|
|
358 |
Assert.isNumber(report.min, "Min should be a number."); |
|
|
359 |
Assert.isNumber(report.avg, "Average should be a number."); |
|
|
360 |
}, |
|
|
361 |
|
|
|
362 |
testStartStopPause : function (){ |
|
|
363 |
|
|
|
364 |
Profiler.start("random.entry"); |
|
|
365 |
|
|
|
366 |
for (var i=0; i < 10000; i++){} |
|
|
367 |
|
|
|
368 |
Profiler.pause("random.entry"); |
|
|
369 |
|
|
|
370 |
for (var i=0; i < 10000; i++){} |
|
|
371 |
|
|
|
372 |
Profiler.start("random.entry"); |
|
|
373 |
|
|
|
374 |
for (var i=0; i < 10000; i++){} |
|
|
375 |
|
|
|
376 |
Profiler.stop("random.entry"); |
|
|
377 |
|
|
|
378 |
var report = Profiler.getReport("random.entry"); |
|
|
379 |
|
|
|
380 |
Assert.isObject(report, "Report should be an object."); |
|
|
381 |
Assert.areEqual(1, report.calls, "Call count should be 1."); |
|
|
382 |
Assert.isNumber(report.max, "Max should be a number."); |
|
|
383 |
Assert.isNumber(report.min, "Min should be a number."); |
|
|
384 |
Assert.isNumber(report.avg, "Average should be a number."); |
|
|
385 |
|
|
|
386 |
}, |
|
|
387 |
|
|
|
388 |
testStartTwice : function () { |
|
|
389 |
|
|
|
390 |
Profiler.start("random.entry"); |
|
|
391 |
|
|
|
392 |
for (var i=0; i < 10000; i++){} |
|
|
393 |
|
|
|
394 |
Profiler.stop("random.entry"); |
|
|
395 |
|
|
|
396 |
Profiler.start("random.entry"); |
|
|
397 |
|
|
|
398 |
for (var i=0; i < 10000; i++){} |
|
|
399 |
|
|
|
400 |
Profiler.stop("random.entry"); |
|
|
401 |
|
|
|
402 |
var report = Profiler.getReport("random.entry"); |
|
|
403 |
|
|
|
404 |
Assert.isObject(report, "Report should be an object."); |
|
|
405 |
Assert.areEqual(2, report.calls, "Call count should be 2."); |
|
|
406 |
Assert.isNumber(report.max, "Max should be a number."); |
|
|
407 |
Assert.isNumber(report.min, "Min should be a number."); |
|
|
408 |
Assert.isNumber(report.avg, "Average should be a number."); |
|
|
409 |
} |
|
|
410 |
|
|
|
411 |
|
|
|
412 |
|
|
|
413 |
})); |
|
|
414 |
|
|
|
415 |
//------------------------------------------------------------------------- |
|
|
416 |
// Test Case for report data |
|
|
417 |
//------------------------------------------------------------------------- |
|
|
418 |
|
|
|
419 |
suite.add(new Y.Test.Case({ |
|
|
420 |
|
|
|
421 |
name : "Profiler Report Data Tests", |
|
|
422 |
|
|
|
423 |
testGetReport : function (){ |
|
|
424 |
|
|
|
425 |
Profiler.registerFunction("testObject.factorial", testObject); |
|
|
426 |
|
|
|
427 |
testObject.factorial(10); |
|
|
428 |
|
|
|
429 |
var report = Profiler.getReport("testObject.factorial"); |
|
|
430 |
Profiler.unregisterFunction("testObject.factorial"); |
|
|
431 |
|
|
|
432 |
Assert.isObject(report, "Report should be an object."); |
|
|
433 |
Assert.isNumber(report.calls, "Call count should be a number."); |
|
|
434 |
Assert.isNumber(report.max, "Max should be a number."); |
|
|
435 |
Assert.isNumber(report.min, "Min should be a number."); |
|
|
436 |
Assert.isNumber(report.avg, "Average should be a number."); |
|
|
437 |
}, |
|
|
438 |
|
|
|
439 |
testGetCallCount : function (){ |
|
|
440 |
|
|
|
441 |
Profiler.registerFunction("testObject.factorial", testObject); |
|
|
442 |
|
|
|
443 |
testObject.factorial(10); |
|
|
444 |
|
|
|
445 |
var report = Profiler.getReport("testObject.factorial"); |
|
|
446 |
var callCount = Profiler.getCallCount("testObject.factorial"); |
|
|
447 |
Profiler.unregisterFunction("testObject.factorial"); |
|
|
448 |
|
|
|
449 |
Assert.isObject(report, "Report should be an object."); |
|
|
450 |
Assert.areEqual(10, report.calls, "Report.calls is incorrect."); |
|
|
451 |
Assert.areEqual(10, callCount, "Call count is incorrect."); |
|
|
452 |
|
|
|
453 |
}, |
|
|
454 |
|
|
|
455 |
testGetReport : function () { |
|
|
456 |
|
|
|
457 |
Profiler.registerConstructor("root.SubType", root); |
|
|
458 |
|
|
|
459 |
var o = new root.SubType(); |
|
|
460 |
o.getAge(); |
|
|
461 |
o.getName(); |
|
|
462 |
|
|
|
463 |
var o2 = new root.SubType(); |
|
|
464 |
o2.getAge(); |
|
|
465 |
o2.getName(); |
|
|
466 |
o2.getAge(); |
|
|
467 |
o2.getName(); |
|
|
468 |
o2.getName(); |
|
|
469 |
|
|
|
470 |
var report = Profiler.getFullReport(); |
|
|
471 |
|
|
|
472 |
Profiler.unregisterConstructor("root.SubType"); |
|
|
473 |
|
|
|
474 |
Assert.isObject(report, "Report should be an object."); |
|
|
475 |
Assert.isObject(report["root.SubType"], "There should be an entry for root.SubType."); |
|
|
476 |
Assert.areEqual(2, report["root.SubType"].calls, "root.SubType should have a call count of 2."); |
|
|
477 |
//Assert.isObject(report["root.SubType.prototype"], "There should be an entry for root.SubType.prototype."); |
|
|
478 |
Assert.isObject(report["root.SubType.prototype.getAge"], "There should be an entry for getAge()"); |
|
|
479 |
Assert.areEqual(3, report["root.SubType.prototype.getAge"].calls, "getAge() should have a call count of 3."); |
|
|
480 |
Assert.isObject(report["root.SubType.prototype.getName"], "There should be an entry for getName()"); |
|
|
481 |
Assert.areEqual(4, report["root.SubType.prototype.getName"].calls, "getName() should have a call count of 4."); |
|
|
482 |
} |
|
|
483 |
|
|
|
484 |
|
|
|
485 |
|
|
|
486 |
})); |
|
|
487 |
|
|
|
488 |
//return it |
|
|
489 |
return suite; |
|
|
490 |
|
|
|
491 |
})(); |
|
|
492 |
|
|
|
493 |
|
|
|
494 |
var r = new Y.Console({ |
|
|
495 |
verbose : true, |
|
|
496 |
//consoleLimit : 10, |
|
|
497 |
newestOnTop : false |
|
|
498 |
}); |
|
|
499 |
|
|
|
500 |
r.render('#c'); |
|
|
501 |
|
|
|
502 |
|
|
|
503 |
//add to the testrunner and run |
|
|
504 |
Y.Test.Runner.add(Y.Tests.Profiler); |
|
|
505 |
Y.Test.Runner.run(); |
|
|
506 |
|
|
|
507 |
/*if (parent && parent != window) { |
|
|
508 |
YAHOO.tool.TestManager.load(); |
|
|
509 |
} else { |
|
|
510 |
YAHOO.tool.TestRunner.run(); |
|
|
511 |
}*/ |
|
|
512 |
|
|
|
513 |
}); |
|
|
514 |
|
|
|
515 |
|
|
|
516 |
</script> |
|
|
517 |
</body> |
|
|
518 |
</html> |