From 8d3bb806b0fd301d5180a211dfe5880fd2ee2506 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 24 Jul 2010 20:26:34 +0000 Subject: * test/ruby/envutil.rb (EnvUtil#.suppress_warning): added. * test/ruby/test_float.rb (TestFloat#test_Float): suppress warnings under --verbose. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_float.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test/ruby/test_float.rb') diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb index 03d9c94766..5f3e98a6fd 100644 --- a/test/ruby/test_float.rb +++ b/test/ruby/test_float.rb @@ -1,6 +1,9 @@ require 'test/unit' +require_relative 'envutil' class TestFloat < Test::Unit::TestCase + include EnvUtil + def test_float assert_equal(2, 2.6.floor) assert_equal(-3, (-2.6).floor) @@ -426,10 +429,10 @@ class TestFloat < Test::Unit::TestCase def test_Float assert_in_delta(0.125, Float("0.1_2_5"), 0.00001) assert_in_delta(0.125, "0.1_2_5__".to_f, 0.00001) - assert_equal(1, Float(([1] * 10000).join).infinite?) + assert_equal(1, suppress_warning {Float(([1] * 10000).join)}.infinite?) assert(!Float(([1] * 10000).join("_")).infinite?) # is it really OK? assert_raise(ArgumentError) { Float("1.0\x001") } - assert_equal(1, Float("1e10_00").infinite?) + assert_equal(1, suppress_warning {Float("1e10_00")}.infinite?) assert_raise(TypeError) { Float(nil) } o = Object.new def o.to_f; inf = Float::INFINITY; inf/inf; end -- cgit v1.2.3