summaryrefslogtreecommitdiff
path: root/tool/lib/test/unit/testcase.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tool/lib/test/unit/testcase.rb')
-rw-r--r--tool/lib/test/unit/testcase.rb36
1 files changed, 12 insertions, 24 deletions
diff --git a/tool/lib/test/unit/testcase.rb b/tool/lib/test/unit/testcase.rb
index 13256f8ed1..51ffff37eb 100644
--- a/tool/lib/test/unit/testcase.rb
+++ b/tool/lib/test/unit/testcase.rb
@@ -137,6 +137,9 @@ module Test
attr_reader :__name__ # :nodoc:
+ # Method name of this test.
+ alias method_name __name__
+
PASSTHROUGH_EXCEPTIONS = [NoMemoryError, SignalException,
Interrupt, SystemExit] # :nodoc:
@@ -144,8 +147,7 @@ module Test
# Runs the tests reporting the status to +runner+
def run runner
- @options = runner.options
-
+ @__runner_options__ = runner.options
trap "INFO" do
runner.report.each_with_index do |msg, i|
warn "\n%3d) %s" % [i + 1, msg]
@@ -161,7 +163,7 @@ module Test
result = ""
begin
- @passed = nil
+ @__passed__ = nil
self.before_setup
self.setup
self.after_setup
@@ -169,11 +171,11 @@ module Test
result = "." unless io?
time = Time.now - start_time
runner.record self.class, self.__name__, self._assertions, time, nil
- @passed = true
+ @__passed__ = true
rescue *PASSTHROUGH_EXCEPTIONS
raise
rescue Exception => e
- @passed = Test::Unit::PendedError === e
+ @__passed__ = Test::Unit::PendedError === e
time = Time.now - start_time
runner.record self.class, self.__name__, self._assertions, time, e
result = runner.puke self.class, self.__name__, e
@@ -184,7 +186,7 @@ module Test
rescue *PASSTHROUGH_EXCEPTIONS
raise
rescue Exception => e
- @passed = false
+ @__passed__ = false
runner.record self.class, self.__name__, self._assertions, time, e
result = runner.puke self.class, self.__name__, e
end
@@ -206,12 +208,12 @@ module Test
def initialize name # :nodoc:
@__name__ = name
@__io__ = nil
- @passed = nil
- @@current = self # FIX: make thread local
+ @__passed__ = nil
+ @@__current__ = self # FIX: make thread local
end
def self.current # :nodoc:
- @@current # FIX: make thread local
+ @@__current__ # FIX: make thread local
end
##
@@ -236,20 +238,6 @@ module Test
reset
- ##
- # Make diffs for this TestCase use #pretty_inspect so that diff
- # in assert_equal can be more details. NOTE: this is much slower
- # than the regular inspect but much more usable for complex
- # objects.
-
- def self.make_my_diffs_pretty!
- require 'pp'
-
- define_method :mu_pp do |o|
- o.pretty_inspect
- end
- end
-
def self.inherited klass # :nodoc:
@@test_suites[klass] = true
super
@@ -277,7 +265,7 @@ module Test
# Returns true if the test passed.
def passed?
- @passed
+ @__passed__
end
##