On Wed, 28 Feb 2001 14:06:43 +0900, Dave Thomas
<Dave / PragmaticProgrammer.com> wrote:
>
>You can add support to RUNIT::TestCase using the 'inherited' method
>(http://www.rubycentral.com/book/ref_c_class.html#inherited)
>like this:
>
>   class TestCase
>      @@subclasses = []
>      def TestCase.inherited(by)
>          @@subclasses << by
>      end
>
>      def TestCase.subclasses
>        @@subclasses
>     end 
>   end

If I do this ...

require 'runit/testcase'

class TestCase
    @@subclasses = []
    def inherited(by)
        @@subclasses << by
    end
    def TestCase.subclasses
        @@subclasses
    end
end

Then RUNIT::TestCase doesn't understand subclasses.

If I do

require 'runit/testcase'

class RUNIT::TestCase
    @@subclasses = []
    def inherited(by)
        @@subclasses << by
    end
    def RUNIT::TestCase.subclasses
        @@subclasses
    end
end

Then I get 

C:\ruby\rondatabase\database.rb:5: parse error
class RUNIT::TestCase
             ^

(the ^ points at the T in TestCase)

I'm confused ... what do I really need to do?

Thanks,

Ron


Ronald E Jeffries
http://www.XProgramming.com
http://www.objectmentor.com