1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/mini/test.rb (MINI_DIR): loaded path is expanded.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-09-28 09:39:53 +00:00
parent 574027ba03
commit 6952b1a52a
2 changed files with 7 additions and 13 deletions

View file

@ -1,3 +1,7 @@
Sun Sep 28 18:39:51 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/mini/test.rb (MINI_DIR): loaded path is expanded.
Sun Sep 28 12:36:09 2008 Koichi Sasada <ko1@atdot.net> Sun Sep 28 12:36:09 2008 Koichi Sasada <ko1@atdot.net>
* vm_exec.c (vm_exec_core): add an UNLIKELY() hint. * vm_exec.c (vm_exec_core): add an UNLIKELY() hint.

View file

@ -13,28 +13,18 @@
module Mini module Mini
class Assertion < Exception; end class Assertion < Exception; end
file = if __FILE__ =~ /^[^\.]/ then # OMG ruby 1.9 is so lame (rubinius too) MINI_DIR = File.expand_path("../..", __FILE__)
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 def self.filter_backtrace bt
return ["No backtrace"] unless bt return ["No backtrace"] unless bt
new_bt = [] new_bt = []
bt.each do |line| bt.each do |line|
break if line.index(MINI_DIR) == 0 break if line.index(MINI_DIR, 0)
new_bt << line new_bt << line
end 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.empty?
new_bt = bt.dup if new_bt.empty? new_bt = bt.dup if new_bt.empty?