On Apr 7, 2005, at 12:46 PM, Ovid wrote:
Great work!
Thanks.
Output them to a Results object which, by default, sends the output to document.write() but allows the user to redirect the output. For example, it might be nice to have test results pop up in a separate window while the main page loads.
Hrm. I'll give that some thought. Not sure if it needs an object other than a function reference, though...
How about:
if (some_condition) { // do your tests } else { skip(number_of_tests) }
That'd be easy enough.
And:
while(todo(4)) { // sets an internal todo counter // each test automagically decrements the todo counter // ... but this should be transparent to the test code }
A little tricky, but do-able, I think.
Will this screw up a stack trace?
No, since right now there *is* no stack trace. I'm not sure how to get at that data in JavaScript.
Also, while javascript doesn't have the Perl concept of context, are there any scoping issues this might cause problems with? Will passing a function reference have any chance of altering the behavior of the code (it would in Perl).
I don't think so. Function references in JavaScript are purely lexical, so they always execute in the scope in which they are defined.
Regards,
David