#110 ✓resolved
bahuvrihi

updates for mini/unit

Reported by bahuvrihi | October 2nd, 2008 @ 10:16 AM

Mini::Unit will be the new thing in 1.9. Tap::Test needs a few updates to make that happen:

In Tap::Test:


        case
        when method_defined?(:suite)

          # Test::Unit
          alias :original_suite :suite

          # Modifies the default suite method to skip the suit unless
          # run_test_suite is true.  If the test is skipped, the skip_messages
          # will be printed along with the default 'Skipping <Test>' message.
          def suite # :nodoc:
            if run_test_suite
              original_suite
            else
              skip_message = skip_messages.compact.join(', ')
              puts "Skipping #{name}#{skip_message.empty? ? '' : ': ' + skip_message}"

              # return an empty test suite of the appropriate name
              Test::Unit::TestSuite.new(name)
            end
          end

        when method_defined?(:test_suites)
          # mini/unit
          alias :original_test_suites :test_suites

          def test_suites
            if run_test_suite
              original_test_suites
            else
              skip_message = skip_messages.compact.join(', ')
              puts "Skipping #{name}#{skip_message.empty? ? '' : ': ' + skip_message}"
              {}
            end
          end

        else
          raise "unknown testing framework? (should be Test::Unit or Mini::Unit)"
        end

In Tap::Test::FileTest, something will need to be added/overridden to figure out if the test failed. Currently the only known solution is to override run:


      def run runner
        result = '.'
        begin
          @test_passed = true
          self.setup
          self.__send__ self.name
        rescue Exception => e
          @test_passed = false
          result = runner.puke(self.class, self.name, e)
        ensure
          begin
            self.teardown
          rescue Exception => e
            result = runner.puke(self.class, self.name, e)
          end
        end
        result
      end

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

A framework for making configurable, file-based tasks and workflows.

People watching this ticket

Pages