So excited to see that you are actively working on this John! :-)

I can see you've been concentrating on document parsing behavior, while I've
just been looking at "automated testing in rhino". From my testing
perspective, I made a couple of patches:
- in test(), wrapping fn() and the next lines in try/catch/fail, so tests
don't fail silently but get logged
- as part of testrunner's results() method, quit with error code if there
was a failure, so ant build can stop if a failure occurred.

I also patched another bug (I'm not sure whether you experience this bug
too..)
$.get callback wasn't being called.
I tracked it down to the setInterval/clearInterval code.
2 problems:
- the very first setInterval returns 0, which evaluates to false in jquery,
and so timer will never be stopped, because in jquery you do    if (ival)
- as soon as stop() is called, the entire rhino engine stops! not sure
why..... stop() is deprecated anyway. easy workaround though, I changed it
to use the standard java runnable stop pattern of checking a local variable
and returning:


//--------------
        // Timers

        var timers = [{}];
        
        window.setTimeout = function(fn, time){
                var num;
                return num = setInterval(function(){
                        fn();
                        clearInterval(num);
                }, time);
        };
        
        window.setInterval = function(fn, time){
                var num = timers.length;
                var isRunning = true;
                var timerObj = {
                        thread: new java.lang.Thread(new java.lang.Runnable({
                                run: function(){
                                        while (isRunning){
                                                
java.lang.Thread.currentThread().sleep(time);
                                                fn();
                                        }
                                }
                        })),
                        stop: function() {isRunning = false;}
                };
                timers[num] = timerObj;
                timers[num].thread.start();
        
                return num;
        };
        
        window.clearInterval = function(num){
                if ( timers[num] ) {
                        timers[num].stop();
                        delete timers[num];
                }
        };

//--------------

If you like, I can keep posting my findings on this thread as I find them.
Once again, good to see you working on env.js, its amazing!
Keep up the good work John!





John Resig wrote:
> 
> I'm working on this (well, trying to get more of the jQuery test suite
> to pass). I've broken it out into a separate project here:
> http://github.com/jeresig/env-js/tree/master
> 

-- 
View this message in context: 
http://www.nabble.com/jQuery-test-suite-and-jsUnit-compatibility-tp15882865s27240p18136064.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to