summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-12 13:33:16 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-12 13:33:16 +0000
commitc4ef3b5518129a9dece0b12203638ccea6167105 (patch)
tree4aea3d099f53d14d32cf5f250072b9af22b6d2ab /lib
parentcc6f54760fd113a272b1cee6e53ce1252d90f243 (diff)
merges r21449 from trunk into ruby_1_9_1.
* 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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/test/unit/assertions.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb
index c15432f05..ac3ecf93c 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