summaryrefslogtreecommitdiff
path: root/test/ruby/test_float.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-24 20:26:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-24 20:26:34 +0000
commit8d3bb806b0fd301d5180a211dfe5880fd2ee2506 (patch)
tree812bf13d1f79b30df672fad073f6a9226f8b4ede /test/ruby/test_float.rb
parentb2d009fc7bead0a8c0ee45821acd46defa8a912b (diff)
* 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
Diffstat (limited to 'test/ruby/test_float.rb')
-rw-r--r--test/ruby/test_float.rb7
1 files changed, 5 insertions, 2 deletions
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