diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-13 03:41:01 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-13 03:41:01 +0000 |
commit | 3b1a65add329a757be6679282d3d3206e58cff2e (patch) | |
tree | 1166c480960e5d79a51b6730b20a751f70c1aead | |
parent | ac6024f5221862e628d1ba201cbc422a672a9dc8 (diff) | |
download | ruby-3b1a65add329a757be6679282d3d3206e58cff2e.tar.gz |
* lib/minitest/test.rb (MinTest::Unit#location):
skips user-defined assertions as MiniTest's.
e.g. for test/ruby/test_m17n.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | lib/minitest/unit.rb | 8 |
2 files changed, 12 insertions, 2 deletions
@@ -1,3 +1,9 @@ +Sat Dec 13 12:38:16 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp> + + * lib/minitest/test.rb (MinTest::Unit#location): + skips user-defined assertions as MiniTest's. + e.g. for test/ruby/test_m17n.rb. + Sat Dec 13 09:17:33 2008 Ryan Davis <ryand-ruby@zenspider.com> * lib/minitest/*.rb: Imported minitest 1.3.2 r4503. diff --git a/lib/minitest/unit.rb b/lib/minitest/unit.rb index 77176240c5..7807e2e3eb 100644 --- a/lib/minitest/unit.rb +++ b/lib/minitest/unit.rb @@ -336,8 +336,12 @@ p $! end def location e - e.backtrace.find { |s| - s !~ /in .(assert|refute|flunk|pass|fail|raise)/ + e.backtrace.reverse.inject(""){ |last, s| + if s =~ /in .(assert|refute|flunk$|pass$|fail$|raise$)/ + break last + else + s + end }.sub(/:in .*$/, '') end |