summaryrefslogtreecommitdiff
path: root/test/minitest/test_mini_test.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-15 03:34:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-15 03:34:18 +0000
commit0596555042765213809264066fee32a736e175e5 (patch)
tree8716353ee11862b1fd37e40ed102c36b784d9169 /test/minitest/test_mini_test.rb
parentd85689f5cb7ae6faa4cbf938679f8338331f5f66 (diff)
* test/minitest/test_mini_test.rb: fixed tests depending on the
detail of floating point representation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/minitest/test_mini_test.rb')
-rw-r--r--test/minitest/test_mini_test.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/test/minitest/test_mini_test.rb b/test/minitest/test_mini_test.rb
index 046ae66d88..aa90dd6186 100644
--- a/test/minitest/test_mini_test.rb
+++ b/test/minitest/test_mini_test.rb
@@ -468,9 +468,10 @@ class TestMiniTestTestCase < MiniTest::Unit::TestCase
end
def test_assert_in_delta_triggered
- util_assert_triggered 'Expected 0.0 - 0.001 (0.001) to be < 1.0e-06.' do
+ e = assert_raises(MiniTest::Assertion) do
@tc.assert_in_delta 0.0, 1.0 / 1000, 0.000001
end
+ assert_match /\AExpected 0\.0 - 0\.001 \(0\.001\) to be < (?:1\.0+\de-06|9\.9+\de-07).\z/, e.message
end
def test_assert_in_epsilon
@@ -488,9 +489,10 @@ class TestMiniTestTestCase < MiniTest::Unit::TestCase
end
def test_assert_in_epsilon_triggered
- util_assert_triggered 'Expected 10000 - 9990 (10) to be < 9.99.' do
+ e = assert_raises(MiniTest::Assertion) do
@tc.assert_in_epsilon 10000, 9990
- end
+ end
+ assert_match(/\AExpected 10000 - 9990 \(10\) to be < 9\.99*\d*\.\z/, e.message)
end
def test_assert_includes
@@ -829,9 +831,10 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
end
def test_refute_in_delta_triggered
- util_assert_triggered 'Expected 0.0 - 0.001 (0.001) to not be < 0.1.' do
+ e = assert_raises(MiniTest::Assertion) do
@tc.refute_in_delta 0.0, 1.0 / 1000, 0.1
end
+ assert_match /\AExpected 0\.0 - 0\.001 \(0\.001\) to not be < 0\.10*\d*\.\z/, e.message
end
def test_refute_in_epsilon
@@ -980,6 +983,11 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
msg = e.message.sub(/(---Backtrace---).*/m, '\1')
msg.gsub!(/\(0x[0-9a-f]+\)/, '(0xXXX)')
- assert_equal expected, msg
+ begin
+ assert_equal expected, msg
+ rescue MiniTest::Assertion => e
+ e.backtrace.shift(3)
+ raise
+ end
end
end