Sha256: 88f492b466bfb936c754f73fd3cd8c149721669b6bef11c6a38d72228c1d856a

Contents?: true

Size: 1.18 KB

Versions: 7

Compression:

Stored size: 1.18 KB

Contents

# Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
# This is free software with ABSOLUTELY NO WARRANTY.
# You can redistribute it and/or modify it under the terms of the GNU GPL 2.

#
# A patch to test/unit/ui/console/testrunner.rb
# You can see the elapsed time of each test case.
#

require 'test/unit'
require 'test/unit/ui/console/testrunner'
# Load testrunner.rb at the first to patch it.

module Test
  module Unit
    module UI
      module Console
        class TestRunner
	  alias :org_test_started :test_started
          def test_started(name)
            output_single("#{name}: ", VERBOSE)
	    $test_unit_start_time = Time.now
          end

	  alias :org_test_finished :test_finished
          def test_finished(name)
            output_single('.', PROGRESS_ONLY) unless @displayed
	    elapsed_time = Time.now - $test_unit_start_time
	    str = sprintf(' (%0.02f)', elapsed_time)
            output_single(str, VERBOSE) unless @displayed
            nl(VERBOSE)
            @displayed = false
          end
	end
      end
    end

    module Assertions
      alias ok assert
      alias ok_eq assert_equal
      alias eq assert_equal
      alias is assert_equal
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
qwik2md-2.0.1 vendor/qwik/lib/qwik/testunit.rb
qwik2md-2.0.0 vendor/qwik/lib/qwik/testunit.rb
qwik2md-1.0.2 vendor/qwik/lib/qwik/testunit.rb
qwik2md-1.0.1 vendor/qwik/lib/qwik/testunit.rb
qwik2md-1.0.0 vendor/qwik/lib/qwik/testunit.rb
qwik2md-0.1.0 vendor/qwik/lib/qwik/testunit.rb
qwikdoc-0.0.1 vendor/qwik/testunit.rb