summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_complex.rb6
-rw-r--r--test/ruby/test_integer.rb9
-rw-r--r--test/ruby/test_rational.rb6
3 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb
index 4aa3eda1d4..0161ce8ffe 100644
--- a/test/ruby/test_complex.rb
+++ b/test/ruby/test_complex.rb
@@ -864,9 +864,15 @@ class Complex_Test < Test::Unit::TestCase
assert_equal(nil, Complex('5x', exception: false))
}
assert_nothing_raised(ArgumentError){
+ assert_equal(nil, Complex(nil, exception: false))
+ }
+ assert_nothing_raised(ArgumentError){
assert_equal(nil, Complex(Object.new, exception: false))
}
assert_nothing_raised(ArgumentError){
+ assert_equal(nil, Complex(1, nil, exception: false))
+ }
+ assert_nothing_raised(ArgumentError){
assert_equal(nil, Complex(1, Object.new, exception: false))
}
diff --git a/test/ruby/test_integer.rb b/test/ruby/test_integer.rb
index a73992787d..69347b6b11 100644
--- a/test/ruby/test_integer.rb
+++ b/test/ruby/test_integer.rb
@@ -175,6 +175,15 @@ class TestInteger < Test::Unit::TestCase
def o.to_int; raise; end
assert_equal(nil, Integer(o, exception: false))
}
+ assert_nothing_raised(FloatDomainError) {
+ assert_equal(nil, Integer(Float::INFINITY, exception: false))
+ }
+ assert_nothing_raised(FloatDomainError) {
+ assert_equal(nil, Integer(-Float::INFINITY, exception: false))
+ }
+ assert_nothing_raised(FloatDomainError) {
+ assert_equal(nil, Integer(Float::NAN, exception: false))
+ }
assert_raise(ArgumentError) {
Integer("1z", exception: true)
diff --git a/test/ruby/test_rational.rb b/test/ruby/test_rational.rb
index b289753347..a8cdf22a49 100644
--- a/test/ruby/test_rational.rb
+++ b/test/ruby/test_rational.rb
@@ -816,9 +816,15 @@ class Rational_Test < Test::Unit::TestCase
assert_equal(nil, Rational("1/0", exception: false))
}
assert_nothing_raised(TypeError) {
+ assert_equal(nil, Rational(nil, exception: false))
+ }
+ assert_nothing_raised(TypeError) {
assert_equal(nil, Rational(Object.new, exception: false))
}
assert_nothing_raised(TypeError) {
+ assert_equal(nil, Rational(1, nil, exception: false))
+ }
+ assert_nothing_raised(TypeError) {
assert_equal(nil, Rational(1, Object.new, exception: false))
}