summaryrefslogtreecommitdiff
path: root/test/ruby/test_float.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_float.rb')
-rw-r--r--test/ruby/test_float.rb51
1 files changed, 1 insertions, 50 deletions
diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb
index 7cbf3b5a8f..7fabfd351d 100644
--- a/test/ruby/test_float.rb
+++ b/test/ruby/test_float.rb
@@ -788,15 +788,9 @@ class TestFloat < Test::Unit::TestCase
assert_raise(ArgumentError) { Float('0xf.p0') }
assert_raise(ArgumentError) { Float('0xf.f') }
assert_raise(ArgumentError) { Float('0xf.fp') }
- begin
- verbose_bak, $VERBOSE = $VERBOSE, nil
- assert_equal(Float::INFINITY, Float('0xf.fp1000000000000000'))
- ensure
- $VERBOSE = verbose_bak
- end
+ assert_equal(Float::INFINITY, Float('0xf.fp1000000000000000'))
assert_equal(1, suppress_warning {Float("1e10_00")}.infinite?)
assert_raise(TypeError) { Float(nil) }
- assert_raise(TypeError) { Float(:test) }
o = Object.new
def o.to_f; inf = Float::INFINITY; inf/inf; end
assert_predicate(Float(o), :nan?)
@@ -807,49 +801,6 @@ class TestFloat < Test::Unit::TestCase
assert_raise(ArgumentError, bug4310) {under_gc_stress {Float('a'*10000)}}
end
- def test_Float_with_invalid_exception
- assert_raise(ArgumentError) {
- Float("0", exception: 1)
- }
- end
-
- def test_Float_with_exception_keyword
- assert_raise(ArgumentError) {
- Float(".", exception: true)
- }
- assert_nothing_raised(ArgumentError) {
- assert_equal(nil, Float(".", exception: false))
- }
- assert_raise(RangeError) {
- Float(1i, exception: true)
- }
- assert_nothing_raised(RangeError) {
- assert_equal(nil, Float(1i, exception: false))
- }
- assert_raise(TypeError) {
- Float(nil, exception: true)
- }
- assert_nothing_raised(TypeError) {
- assert_equal(nil, Float(nil, exception: false))
- }
- assert_nothing_raised(TypeError) {
- assert_equal(nil, Float(:test, exception: false))
- }
- assert_nothing_raised(TypeError) {
- assert_equal(nil, Float(Object.new, exception: false))
- }
- assert_nothing_raised(TypeError) {
- o = Object.new
- def o.to_f; 3.14; end
- assert_equal(3.14, Float(o, exception: false))
- }
- assert_nothing_raised(RuntimeError) {
- o = Object.new
- def o.to_f; raise; end
- assert_equal(nil, Float(o, exception: false))
- }
- end
-
def test_num2dbl
assert_raise(ArgumentError, "comparison of String with 0 failed") do
1.0.step(2.0, "0.5") {}