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

test_cdhash: refactor change class

It is now strange to test Complex in a class named Rational_Test.
This commit is contained in:
卜部昌平 2021-05-10 10:02:12 +09:00
parent 0ab0b86c84
commit 6911b4bc82
Notes: git 2021-05-12 10:31:12 +09:00
2 changed files with 15 additions and 15 deletions

View file

@ -830,21 +830,6 @@ class Rational_Test < Test::Unit::TestCase
assert_raise(ZeroDivisionError) {Rational("1/0")}
end
def test_cdhash
assert_separately([], <<-RUBY)
n = case 1 when 2r then false else true end
assert_equal(n, true, '[ruby-core:103759] [Bug #17854]')
RUBY
assert_separately([], <<-RUBY)
n = case 3/2r when 1.5r then true else false end
assert_equal(n, true, '[ruby-core:103759] [Bug #17854]')
RUBY
assert_separately([], <<-RUBY)
n = case 1i when 1i then true else false end
assert_equal(n, true, '[ruby-core:103759] [Bug #17854]')
RUBY
end
def test_Rational_with_invalid_exception
assert_raise(ArgumentError) {
Rational("1/1", exception: 1)

View file

@ -1730,6 +1730,21 @@ eom
assert_equal [[4, 1, 5, 2, 3], {a: 1}], obj.foo(4, 5, 2, 3, a: 1){|args, kws| [args, kws]}
end
def test_cdhash
assert_separately([], <<-RUBY)
n = case 1 when 2r then false else true end
assert_equal(n, true, '[ruby-core:103759] [Bug #17854]')
RUBY
assert_separately([], <<-RUBY)
n = case 3/2r when 1.5r then true else false end
assert_equal(n, true, '[ruby-core:103759] [Bug #17854]')
RUBY
assert_separately([], <<-RUBY)
n = case 1i when 1i then true else false end
assert_equal(n, true, '[ruby-core:103759] [Bug #17854]')
RUBY
end
private
def not_label(x) @result = x; @not_label ||= nil end