diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-25 07:53:19 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-25 07:53:19 +0000 |
commit | dea63a4569d9fe682553f0622cd4cd4d1c3c31a8 (patch) | |
tree | 06c530757057315722fbf9ad5851933eb882ac13 | |
parent | 7ab330203aa2409578bdd9f8ee5ac06b9f69eff3 (diff) | |
download | ruby-dea63a4569d9fe682553f0622cd4cd4d1c3c31a8.tar.gz |
Added passed? per Jim's request. Fixed file/line reporting bug for refutations per Dave's bug report. Very minor cleanup of some nits that were bugging me. Barring other bug reports, I'm 'done'. This version will most likely be released as a gem in the next day or two.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | lib/mini/test.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/mini/test.rb b/lib/mini/test.rb index 88cc9deafc..e08d4dd93e 100644 --- a/lib/mini/test.rb +++ b/lib/mini/test.rb @@ -142,7 +142,7 @@ module Mini end exp = exp.first if exp.size == 1 - flunk "#{mu_pp(exp)} expected but nothing was raised." if should_raise + fail "#{mu_pp(exp)} expected but nothing was raised." if should_raise end def assert_respond_to obj, meth, msg = nil @@ -322,7 +322,7 @@ module Mini if Mini::Assertion === e then @failures += 1 - loc = e.backtrace.find { |s| s !~ /in .(assert|flunk|pass|fail|raise)/ } + loc = e.backtrace.find { |s| s !~ /in .(assert|refute|flunk|pass|fail|raise)/ } loc.sub!(/:in .*$/, '') @report << "Failure:\n#{meth}(#{klass}) [#{loc}]:\n#{e.message}\n" @@ -376,7 +376,7 @@ module Mini return failures + errors if @test_count > 0 # or return nil... end - def run_test_suites filter = /^test/ + def run_test_suites filter = /./ @test_count, @assertion_count = 0, 0 old_sync, @@out.sync = @@out.sync, true if @@out.respond_to? :sync= TestCase.test_suites.each do |suite| @@ -405,9 +405,12 @@ module Mini def run runner result = '.' begin + @passed = nil self.setup self.__send__ self.name + @passed = true rescue Exception => e + @passed = false result = runner.puke(self.class, self.name, e) ensure begin @@ -421,6 +424,7 @@ module Mini def initialize name @name = name + @passed = nil end def self.reset @@ -457,6 +461,10 @@ module Mini def setup; end def teardown; end + def passed? + @passed + end + include Mini::Assertions end # class TestCase end # class Test |