------art_46120_8525417.1148334461735
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On 5/22/06, Eric Hodel <drbrain / segment7.net> wrote:
>
> http://wiki.openqa.org/display/WTR/Test-Unit+Patch
>
> I don't see a patch there.


Click "Download Patch." Or click the attachments tab. I also just added a
link at the bottom of the page.

I have been updating the code on this page based on comments that i get.

Here's the current version of the code:

require 'test/unit'

module Test
  module Unit
    class TestCase
      @@order = :alphabetically
      class << self
        attr_accessor :test_methods, :order
        def test_methods
          @test_methods ||= []
        end
        def order
          @order || @@order
        end
        def default_order= order
          @@order = order
        end
        def sorted_test_methods
          case order
          when :alphabetically:          test_methods.sort
          when :sequentially:            test_methods
          when :reversed_sequentially:   test_methods.reverse
          when :reversed_alphabetically: test_methods.sort.reverse
          else raise ArgumentError, "Execute option not supported:
#{@order}"
          end
        end
        def suite
          suite = TestSuite.new(name)
          sorted_test_methods.each do |test|
            catch :invalid_test do
              suite << new(test)
            end
          end
          if (suite.empty?)
            catch :invalid_test do
              suite << new(:default_test)
            end
          end
          return suite
        end
        def method_added id
          name = id.id2name
          test_methods << name if name =~ /^test./
        end
        def execute order
          @order = order
        end
      end
    end
  end
end

------art_46120_8525417.1148334461735--