Object
Subclass TestCase to create your own tests. Typically you’ll want a TestCase subclass per implementation class.
Returns true if the test passed.
# File minitest/unit.rb, line 760
def passed?
@passed
end
Runs the tests reporting the status to runner
# File minitest/unit.rb, line 684
def run runner
trap 'INFO' do
warn '%s#%s %.2fs' % [self.class, self.__name__,
(Time.now - runner.start_time)]
runner.status $stderr
end if SUPPORTS_INFO_SIGNAL
result = '.'
begin
@passed = nil
self.setup
self.__send__ self.__name__
@passed = true
rescue *PASSTHROUGH_EXCEPTIONS
raise
rescue Exception => e
@passed = false
result = runner.puke(self.class, self.__name__, e)
ensure
begin
self.teardown
rescue *PASSTHROUGH_EXCEPTIONS
raise
rescue Exception => e
result = runner.puke(self.class, self.__name__, e)
end
trap 'INFO', 'DEFAULT' if SUPPORTS_INFO_SIGNAL
end
result
end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please see Improve the docs, or visit Documenting-ruby.org.