diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-30 04:17:56 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-30 04:17:56 +0000 |
commit | 9fad1aca4f67e944eb9c1c174604495c824ae607 (patch) | |
tree | a6f5e47662203fbe0863b099347d776756b4be8d /lib | |
parent | 971c9ffa96a00adce169b5b3f7d30fa5930f6531 (diff) | |
download | ruby-9fad1aca4f67e944eb9c1c174604495c824ae607.tar.gz |
rolled out change 19608... not 1.8 compatible.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mini/test.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/mini/test.rb b/lib/mini/test.rb index e19029c465..bb5fc07724 100644 --- a/lib/mini/test.rb +++ b/lib/mini/test.rb @@ -14,18 +14,28 @@ module Mini class Assertion < Exception; end class Skip < Assertion; end - MINI_DIR = File.expand_path("../..", __FILE__) + file = if __FILE__ =~ /^[^\.]/ then # OMG ruby 1.9 is so lame (rubinius too) + require 'pathname' + pwd = Pathname.new(Dir.pwd) + pn = Pathname.new(File.expand_path(__FILE__)) + pn = File.join(".", pn.relative_path_from(pwd)) unless pn.relative? + pn.to_s + else + __FILE__ + end + + MINI_DIR = File.dirname(File.dirname(file)) def self.filter_backtrace bt return ["No backtrace"] unless bt new_bt = [] bt.each do |line| - break if line.index(MINI_DIR, 0) + break if line.index(MINI_DIR) == 0 new_bt << line end - new_bt = bt.reject { |line| line.index(MINI_DIR, 0) } if + new_bt = bt.reject { |line| line.index(MINI_DIR) == 0 } if new_bt.empty? new_bt = bt.dup if new_bt.empty? |