1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test/ruby/test_float.rb: suppress an overflow warning

```
warning: Float 0xf.fp10000000000000... out of range
```
This commit is contained in:
Yusuke Endoh 2019-07-31 14:35:21 +09:00
parent e83ec207cd
commit 06574ad945

View file

@ -788,7 +788,12 @@ class TestFloat < Test::Unit::TestCase
assert_raise(ArgumentError) { Float('0xf.p0') }
assert_raise(ArgumentError) { Float('0xf.f') }
assert_raise(ArgumentError) { Float('0xf.fp') }
assert_equal(Float::INFINITY, Float('0xf.fp1000000000000000'))
begin
verbose_bak, $VERBOSE = $VERBOSE, nil
assert_equal(Float::INFINITY, Float('0xf.fp1000000000000000'))
ensure
$VERBOSE = verbose_bak
end
assert_equal(1, suppress_warning {Float("1e10_00")}.infinite?)
assert_raise(TypeError) { Float(nil) }
assert_raise(TypeError) { Float(:test) }