From: Jason Creighton Date: 2003-07-02T05:11:12+09:00 Subject: Re: inifinite recursion && test/unit On Tue, 1 Jul 2003 22:06:46 +0900 Andrey Kulinich wrote: > > Neither, it's correct behaviour. If class Recur no longer exists, then the > > call to 'Recur.new' will refer to the function 'new' in module Recur, > > which is itself (hence infinitely recursive). > > I was talking about test/unit. > Why when I'm using it in such code ruby can't detect infinite loop? In > my opinion this is test/unit's bug. Huh? What do you expect Test::Unit to do? Given this input, with ruby-1.8.0-preview3 and whatever version of test/unit comes with that: require 'test/unit' def recursive() recursive() end class TC_recursive < Test::Unit::TestCase def test_recursive recursive() end end ....when run, will give this output: Loaded suite recur Started E Finished in 0.098239 seconds. 1) Error!!! test_recursive(TC_recursive): SystemStackError: stack level too deep recur.rb:6:in `recursive' recur.rb:6:in `recursive' recur.rb:6:in `recursive' recur.rb:6:in `recursive' recur.rb:6:in `recursive' recur.rb:6:in `recursive' recur.rb:6:in `recursive' recur.rb:6:in `recursive' recur.rb:6:in `recursive' recur.rb:6:in `recursive' recur.rb:6:in `recursive' recur.rb:6:in `recursive' recur.rb:11:in `test_recursive' recur.rb:10 1 tests, 0 assertions, 0 failures, 1 errors What's the problem? Jason Creighton