Updated miniunit to 4257. This cleans all my tests when run in isolation. I still have failures when run with everything else
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b43dae5873
commit
852dc6d663
@ -5,8 +5,8 @@ Tue Sep 30 13:19:01 2008 Eric Hodel <drbrain@segment7.net>
|
|||||||
|
|
||||||
Tue Sep 30 13:04:11 2008 Ryan Davis <ryand-ruby@zenspider.com>
|
Tue Sep 30 13:04:11 2008 Ryan Davis <ryand-ruby@zenspider.com>
|
||||||
|
|
||||||
* lib/mini/test.rb: Updated to 1.3.0 r4256.
|
* lib/mini/test.rb: Updated to 1.3.0 r4257.
|
||||||
* test/mini/*: added from r4255.
|
* test/mini/*: added from r4257.
|
||||||
|
|
||||||
Tue Sep 30 07:46:07 2008 Eric Hodel <drbrain@segment7.net>
|
Tue Sep 30 07:46:07 2008 Eric Hodel <drbrain@segment7.net>
|
||||||
|
|
||||||
|
@ -17,9 +17,9 @@ class Mini::Mock
|
|||||||
def expect(name, retval, args=[])
|
def expect(name, retval, args=[])
|
||||||
n, r, a = name, retval, args # for the closure below
|
n, r, a = name, retval, args # for the closure below
|
||||||
@expected_calls[name] = { :retval => retval, :args => args }
|
@expected_calls[name] = { :retval => retval, :args => args }
|
||||||
self.class.__send__(:define_method, name) { |*a|
|
self.class.__send__(:define_method, name) { |*x|
|
||||||
raise ArgumentError unless @expected_calls[n][:args].size == a.size
|
raise ArgumentError unless @expected_calls[n][:args].size == x.size
|
||||||
@actual_calls[n] << { :retval => r, :args => a }
|
@actual_calls[n] << { :retval => r, :args => x }
|
||||||
retval
|
retval
|
||||||
}
|
}
|
||||||
self
|
self
|
||||||
|
@ -14,13 +14,15 @@ module Mini
|
|||||||
class Assertion < Exception; end
|
class Assertion < Exception; end
|
||||||
class Skip < Assertion; end
|
class Skip < Assertion; end
|
||||||
|
|
||||||
file = if __FILE__ =~ /^[^\.]/ then # OMG ruby 1.9 is so lame (rubinius too)
|
file = if RUBY_VERSION =~ /^1\.9/ then # bt's expanded, but __FILE__ isn't :(
|
||||||
|
File.expand_path __FILE__
|
||||||
|
elsif __FILE__ =~ /^[^\.]/ then # assume both relative
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
pwd = Pathname.new(Dir.pwd)
|
pwd = Pathname.new Dir.pwd
|
||||||
pn = Pathname.new(File.expand_path(__FILE__))
|
pn = Pathname.new File.expand_path(__FILE__)
|
||||||
pn = File.join(".", pn.relative_path_from(pwd)) unless pn.relative?
|
pn = File.join(".", pn.relative_path_from(pwd)) unless pn.relative?
|
||||||
pn.to_s
|
pn.to_s
|
||||||
else
|
else # assume both are expanded
|
||||||
__FILE__
|
__FILE__
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -36,10 +38,8 @@ module Mini
|
|||||||
new_bt << line
|
new_bt << line
|
||||||
end
|
end
|
||||||
|
|
||||||
new_bt = bt.reject { |line| line.rindex(MINI_DIR, 0) } if
|
new_bt = bt.reject { |line| line.rindex(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?
|
||||||
|
|
||||||
new_bt
|
new_bt
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -9,11 +9,6 @@ require 'mini/test'
|
|||||||
|
|
||||||
Mini::Test.autorun
|
Mini::Test.autorun
|
||||||
|
|
||||||
class Mini::Test
|
|
||||||
attr_accessor :test_count
|
|
||||||
attr_accessor :assertion_count
|
|
||||||
end
|
|
||||||
|
|
||||||
class TestMiniTest < Mini::Test::TestCase
|
class TestMiniTest < Mini::Test::TestCase
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@ -47,13 +42,25 @@ class TestMiniTest < Mini::Test::TestCase
|
|||||||
BT_MIDDLE +
|
BT_MIDDLE +
|
||||||
["./lib/mini/test.rb:29",
|
["./lib/mini/test.rb:29",
|
||||||
"test/test_autotest.rb:422"])
|
"test/test_autotest.rb:422"])
|
||||||
|
bt = util_expand_bt bt
|
||||||
|
|
||||||
ex = ["lib/autotest.rb:571:in `add_exception'",
|
ex = ["lib/autotest.rb:571:in `add_exception'",
|
||||||
"test/test_autotest.rb:62:in `test_add_exception'"]
|
"test/test_autotest.rb:62:in `test_add_exception'"]
|
||||||
|
ex = util_expand_bt ex
|
||||||
|
|
||||||
fu = Mini::filter_backtrace(bt)
|
fu = Mini::filter_backtrace(bt)
|
||||||
|
|
||||||
assert_equal ex, fu
|
assert_equal ex, fu
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def util_expand_bt bt
|
||||||
|
if RUBY_VERSION =~ /^1\.9/ then
|
||||||
|
bt.map { |f| (f =~ /^\./) ? File.expand_path(f) : f }
|
||||||
|
else
|
||||||
|
bt
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_filter_backtrace_all_unit
|
def test_filter_backtrace_all_unit
|
||||||
bt = (["./lib/mini/test.rb:165:in `__send__'"] +
|
bt = (["./lib/mini/test.rb:165:in `__send__'"] +
|
||||||
BT_MIDDLE +
|
BT_MIDDLE +
|
||||||
@ -68,6 +75,9 @@ class TestMiniTest < Mini::Test::TestCase
|
|||||||
BT_MIDDLE +
|
BT_MIDDLE +
|
||||||
["./lib/mini/test.rb:29",
|
["./lib/mini/test.rb:29",
|
||||||
"-e:1"])
|
"-e:1"])
|
||||||
|
|
||||||
|
bt = util_expand_bt bt
|
||||||
|
|
||||||
ex = ["-e:1"]
|
ex = ["-e:1"]
|
||||||
fu = Mini::filter_backtrace(bt)
|
fu = Mini::filter_backtrace(bt)
|
||||||
assert_equal ex, fu
|
assert_equal ex, fu
|
||||||
|
Loading…
x
Reference in New Issue
Block a user