From 6b0304a5d7c063018830705b9596fe75ce31329c Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 12 Jan 2009 08:23:07 +0000 Subject: * lib/test/unit/assertions.rb (assert_nothing_raised): removes the current trace to get rid of an issue of MiniTest::Unit#location. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/test/unit/assertions.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb index c15432f058..ac3ecf93c7 100644 --- a/lib/test/unit/assertions.rb +++ b/lib/test/unit/assertions.rb @@ -22,12 +22,18 @@ module Test msg = args.pop end begin - yield + line = __LINE__; yield rescue Exception => e - if ((args.empty? && !e.instance_of?(MiniTest::Assertion)) || + bt = e.backtrace + as = e.instance_of?(MiniTest::Assertion) + if as + ans = /\A#{Regexp.quote(__FILE__)}:#{line}:in /o + bt.reject! {|line| ans =~ line} + end + if ((args.empty? && !as) || args.any? {|a| a.instance_of?(Module) ? e.is_a?(a) : e.class == a }) msg = message(msg) { "Exception raised:\n<#{mu_pp(e)}>" } - raise MiniTest::Assertion, msg.call, e.backtrace + raise MiniTest::Assertion, msg.call, bt else raise end -- cgit v1.2.3