aboutsummaryrefslogtreecommitdiffstats
path: root/test/minitest/test_minitest_unit.rb
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-19 20:34:21 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-19 20:34:21 +0000
commit9bec8ef50ce1858ee2070a1637447eb12ce89990 (patch)
treee6cece58a34cf857c56e47bab13a5eeacd71af71 /test/minitest/test_minitest_unit.rb
parent9cfc7a658f1e6f97fd88ee69310f4ccc5f20d73c (diff)
downloadruby-9bec8ef50ce1858ee2070a1637447eb12ce89990.tar.gz
Imported minitest 2.6.2 (r6712)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/minitest/test_minitest_unit.rb')
-rw-r--r--test/minitest/test_minitest_unit.rb22
1 files changed, 18 insertions, 4 deletions
diff --git a/test/minitest/test_minitest_unit.rb b/test/minitest/test_minitest_unit.rb
index c921ca749e..39e44a33d8 100644
--- a/test/minitest/test_minitest_unit.rb
+++ b/test/minitest/test_minitest_unit.rb
@@ -587,7 +587,7 @@ Finished tests in 0.00
end
def util_expand_bt bt
- if RUBY_VERSION =~ /^1\.9/ then
+ if RUBY_VERSION >= '1.9.0' then
bt.map { |f| (f =~ /^\./) ? File.expand_path(f) : f }
else
bt
@@ -883,6 +883,13 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
@tc.assert_operator 2, :>, 1
end
+ def test_assert_operator_bad_object
+ bad = Object.new
+ def bad.==(other) true end
+
+ @tc.assert_operator bad, :equal?, bad
+ end
+
def test_assert_operator_triggered
util_assert_triggered "Expected 2 to be < 1." do
@tc.assert_operator 2, :<, 1
@@ -990,7 +997,7 @@ FILE:LINE:in `test_assert_raises_triggered_different'
---------------"
actual = e.message.gsub(/^.+:\d+/, 'FILE:LINE')
- actual.gsub!(/block \(\d+ levels\) in /, '') if RUBY_VERSION =~ /^1\.9/
+ actual.gsub!(/block \(\d+ levels\) in /, '') if RUBY_VERSION >= '1.9.0'
assert_equal expected, actual
end
@@ -1011,7 +1018,7 @@ FILE:LINE:in `test_assert_raises_triggered_different_msg'
---------------"
actual = e.message.gsub(/^.+:\d+/, 'FILE:LINE')
- actual.gsub!(/block \(\d+ levels\) in /, '') if RUBY_VERSION =~ /^1\.9/
+ actual.gsub!(/block \(\d+ levels\) in /, '') if RUBY_VERSION >= '1.9.0'
assert_equal expected, actual
end
@@ -1055,7 +1062,7 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
---------------"
actual = e.message.gsub(/^.+:\d+/, 'FILE:LINE')
- actual.gsub!(/block \(\d+ levels\) in /, '') if RUBY_VERSION =~ /^1\.9/
+ actual.gsub!(/block \(\d+ levels\) in /, '') if RUBY_VERSION >= '1.9.0'
assert_equal expected, actual
end
@@ -1364,6 +1371,13 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
@tc.refute_operator 2, :<, 1
end
+ def test_refute_operator_bad_object
+ bad = Object.new
+ def bad.==(other) true end
+
+ @tc.refute_operator true, :equal?, bad
+ end
+
def test_refute_operator_triggered
util_assert_triggered "Expected 2 to not be > 1." do
@tc.refute_operator 2, :>, 1